method_object 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/method_object.rb +9 -0
- data/lib/method_object/version.rb +1 -1
- metadata +4 -4
data/lib/method_object.rb
CHANGED
|
@@ -9,6 +9,10 @@ class MethodObject
|
|
|
9
9
|
new.call(*args)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def to_proc
|
|
13
|
+
method(:call).to_proc
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
end
|
|
@@ -39,6 +43,11 @@ class MethodObjectTestUnitTestCase < Test::Unit::TestCase
|
|
|
39
43
|
assert_equal FindTreasureChest.call(:a, :size => 42), [:a, {:size => 42}, :treasure_chest]
|
|
40
44
|
end
|
|
41
45
|
|
|
46
|
+
def test_to_proc
|
|
47
|
+
assert_equal FindTreasureChest.to_proc.call, [:treasure_chest]
|
|
48
|
+
assert_equal FindTreasureChest.to_proc.call(:foo), [:foo, :treasure_chest]
|
|
49
|
+
end
|
|
50
|
+
|
|
42
51
|
end
|
|
43
52
|
|
|
44
53
|
RUBY
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: method_object
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: wraps up the method object pattern into a class
|
|
15
15
|
email:
|
|
@@ -40,7 +40,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
40
40
|
version: '0'
|
|
41
41
|
segments:
|
|
42
42
|
- 0
|
|
43
|
-
hash:
|
|
43
|
+
hash: 1473977485945476681
|
|
44
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
none: false
|
|
46
46
|
requirements:
|
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
49
49
|
version: '0'
|
|
50
50
|
segments:
|
|
51
51
|
- 0
|
|
52
|
-
hash:
|
|
52
|
+
hash: 1473977485945476681
|
|
53
53
|
requirements: []
|
|
54
54
|
rubyforge_project:
|
|
55
55
|
rubygems_version: 1.8.24
|