optionize 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ AUTHOR = "maiha"
6
6
  EMAIL = "maiha@wota.jp"
7
7
  HOMEPAGE = "http://github.com/maiha/optionize"
8
8
  SUMMARY = "method argument utils"
9
- GEM_VERSION = "0.1.0"
9
+ GEM_VERSION = "0.1.1"
10
10
 
11
11
  spec = Gem::Specification.new do |s|
12
12
  s.rubyforge_project = 'asakusarb'
@@ -22,6 +22,10 @@ class Optionize
22
22
  end
23
23
  end
24
24
 
25
+ def to_hash
26
+ @hash
27
+ end
28
+
25
29
  def [](key)
26
30
  @hash[key.to_s]
27
31
  end
@@ -0,0 +1,11 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper.rb')
2
+
3
+ describe Optionize do
4
+ it "should be merged by hash" do
5
+ hash = {:a=>1}
6
+
7
+ opt = Optionize.new([])
8
+ opt[:b] = 2
9
+ hash.merge(opt).should == {:a=>1, "b"=>2}
10
+ end
11
+ end
@@ -99,4 +99,16 @@ describe Optionize do
99
99
  its("age" ) { should == 16 }
100
100
  end
101
101
 
102
+ ######################################################################
103
+ ### misc
104
+
105
+ describe "functional test" do
106
+ it "should work with 'default' option" do
107
+ # NOTE: to distinct with Hash#default
108
+ args = [:foo, []]
109
+ opts = Optionize.new(args, :name, :default)
110
+ opts.name.should == :foo
111
+ opts.default.should == []
112
+ end
113
+ end
102
114
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optionize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - maiha
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-01 00:00:00 +09:00
12
+ date: 2010-02-02 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -29,6 +29,7 @@ files:
29
29
  - lib/optionize/array.rb
30
30
  - lib/optionize.rb
31
31
  - spec/optionize_spec.rb
32
+ - spec/hash_spec.rb
32
33
  - spec/its_helper.rb
33
34
  - spec/spec_helper.rb
34
35
  - spec/syntax_spec.rb