Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bryanp/aargvark
https://github.com/bryanp/aargvark
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/bryanp/aargvark
- Owner: bryanp
- Created: 2013-12-17T17:18:37.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-17T21:12:09.000Z (almost 11 years ago)
- Last Synced: 2023-08-01T22:16:46.205Z (over 1 year ago)
- Language: Ruby
- Size: 102 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
Aargvark is an experiment in normalizing argument lists in Ruby.
### Examples
Here's a real-world example that led to this code.
```ruby
def compose(*args)
args = Aargv.normalize(*args, path: String, opts: [Hash, {}])# do something with args
endcompose('some/path')
# => { path: 'some/path', opts: {} }compose('some/path', opt: 'val')
# => { path: 'some/path', opts: { opt: 'val' } }compose(opt: 'val')
# => { path: nil, opts: { opt: 'val' } }
```