option_initializer 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,10 +29,10 @@ module OptionInitializer
29
29
  self.class.new @base, @options.merge(opts)
30
30
  end
31
31
 
32
- def method_missing sym, *args
32
+ def method_missing sym, *args, &block
33
33
  # 1.8
34
34
  if @base.instance_methods.map(&:to_sym).include?(sym)
35
- @base.new(@options.dup).send sym, *args
35
+ @base.new(@options.dup).send sym, *args, &block
36
36
  else
37
37
  raise NoMethodError, "undefined method `#{sym}' for #{self}"
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module OptionInitializer
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -29,6 +29,10 @@ class MyClass2
29
29
  def num_options bool
30
30
  @options.length if bool
31
31
  end
32
+
33
+ def echo a
34
+ yield a
35
+ end
32
36
  end
33
37
 
34
38
  class TestOptionInitializer < MiniTest::Unit::TestCase
@@ -57,6 +61,7 @@ class TestOptionInitializer < MiniTest::Unit::TestCase
57
61
 
58
62
  def test_method_missing
59
63
  assert_equal 2, MyClass2.aaa(1).bbb(2).num_options(true)
64
+ assert_equal 2, MyClass2.aaa(1).bbb(2).echo(1) { |a| a * 2 }
60
65
  end
61
66
  end
62
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: option_initializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: