Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
improve env
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Oct 20, 2012
1 parent 82c1bb8 commit 75dfa08
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Expand Up @@ -5,10 +5,12 @@ rvm:
- 1.9.2
- rbx-19mode
- jruby-head
- jruby-19mode

matrix:
allow_failures:
- rvm: rbx-19mode
- rvm: jruby-head
- rvm: jruby-19mode

before_install:
- gem install bundler

2 changes: 1 addition & 1 deletion .yardopts
@@ -1 +1 @@
--readme README.md --private lib/**/*.rb - LICENSE
--readme README.md --private lib/**/*.rb - MIT-LICENSE
File renamed without changes.
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -4,7 +4,7 @@ optionalargument
Description
-----------

Flexible define and parse keyword like arguments too easy.
Flexible define and strict parse keyword like arguments.

Features
--------
Expand All @@ -23,7 +23,7 @@ require 'optionalargument'

class Foo

FUNC_OPTIONS = OptionalArgument.define {
OptArg = OptionalArgument.define {
opt :a
opt :b, default: ':)'
opt :c, must: true
Expand All @@ -33,7 +33,7 @@ class Foo
}

def func(options={})
opts = FUNC_OPTIONS.parse(options)
opts = OptArg.parse(options)
end

end
Expand All @@ -43,7 +43,7 @@ foo = Foo.new
foo.func(a: 1) #=> Error: shortage option parameter: c
opts = foo.func(a: 1,
c: 3)
p opts #=> #<Foo::FUNC_OPTIONS: a=1, c=3>
p opts #=> #<optargs: a=1, c=3, b=":)">
p opts.a? #=> true
p opts.a #=> 1
p opts.b? #=> true
Expand All @@ -56,7 +56,7 @@ foo.func(a: 1, c: 3, e: 5) #=> Error: conflict conbination thrown: a, e
opts = foo.func(c: 3,
e: 5,
d2: 4)
p opts #=> #<Foo::FUNC_OPTIONS: c=3, e=5, d=4, b=":)">
p opts #=> #<optargs: c=3, e=5, d=4, b=":)">
p opts.d3? #=> true
p opts.d3 #=> 4
```
Expand All @@ -83,7 +83,7 @@ Requirements
-------------

* Ruby - [1.9.2 or later](http://travis-ci.org/#!/kachick/optionalargument)
* keyvalidatable - [0.0.3](https://github.com/kachick/keyvalidatable)
* keyvalidatable - [0.0.4](https://github.com/kachick/keyvalidatable)
* validation - [0.0.3](https://github.com/kachick/validation)

Install
Expand Down Expand Up @@ -112,5 +112,5 @@ License

The MIT X11 License
Copyright (c) 2012 Kenichi Kamiya
See the file LICENSE for further details.
See MIT-LICENSE for further details.

8 changes: 4 additions & 4 deletions example/README.rb
Expand Up @@ -4,7 +4,7 @@

class Foo

FUNC_OPTIONS = OptionalArgument.define {
OptArg = OptionalArgument.define {
opt :a
opt :b, default: ':)'
opt :c, must: true
Expand All @@ -14,7 +14,7 @@ class Foo
}

def func(options={})
opts = FUNC_OPTIONS.parse(options)
opts = OptArg.parse(options)
end

end
Expand All @@ -23,7 +23,7 @@ def func(options={})

#foo.func(a: 1) #=> Error: shortage option parameter: c
opts = foo.func a: 1, c: 3
p opts #=> #<Foo::FUNC_OPTIONS: a=1, c=3>
p opts #=> #<optargs: a=1, c=3, b=":)">
p opts.a? #=> true
p opts.a #=> 1
p opts.b? #=> true
Expand All @@ -33,7 +33,7 @@ def func(options={})

#foo.func(a: 1, c: 3, e: 5) #=> Error: conflict conbination thrown: a, e
opts = foo.func c: 3, e: 5, d2: 4
p opts #=> #<Foo::FUNC_OPTIONS: c=3, e=5, d=4, b=":)">
p opts #=> #<optargs: c=3, e=5, d=4, b=":)">
p opts.d3? #=> true
p opts.d3 #=> 4
p opts.to_h #=> {:c=>3, :e=>5, :d=>4, :b=>":)"}
Expand Down
2 changes: 1 addition & 1 deletion optionalargument.gemspec
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = 'optionalargument'
gem.require_paths = ['lib']
gem.version = '0.0.3'
gem.version = '0.0.3.1'

gem.required_ruby_version = '>= 1.9.2'

Expand Down

0 comments on commit 75dfa08

Please sign in to comment.