binder 0.0.5 → 0.0.6
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/README.rdoc +2 -2
- data/lib/binder/object.rb +0 -4
- data/spec/binder/object_spec.rb +1 -72
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -32,9 +32,9 @@ The #bind_to method on a proc instance allows you to change the closure in which
|
|
32
32
|
command.bind_to(Dog.new).call
|
33
33
|
# ==> "ruff!"
|
34
34
|
|
35
|
-
== Object#tell
|
35
|
+
== Object#tell
|
36
36
|
|
37
|
-
The "tell"
|
37
|
+
The "tell" method is essentially short hand for an instance_eval on an object - it simply presents you with a more human readable way of using this language feature:
|
38
38
|
|
39
39
|
class Dog
|
40
40
|
def speak
|
data/lib/binder/object.rb
CHANGED
data/spec/binder/object_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Object do
|
4
|
-
describe "#tell
|
4
|
+
describe "#tell" do
|
5
5
|
it "should run the given block or proc inside the requested object closure" do
|
6
6
|
class Baby
|
7
7
|
def say_dada
|
@@ -23,78 +23,7 @@ describe Object do
|
|
23
23
|
tell(Baby.new, to_say_dada).should == "waaaa"
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
27
|
-
describe "#ask" do
|
28
|
-
it "should run the given block or proc inside the requested object closure" do
|
29
|
-
class Baby
|
30
|
-
def say_dada
|
31
|
-
"waaaa"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
Object.new.ask(Baby.new) { say_dada }.should == "waaaa"
|
36
|
-
Object.ask(Baby.new) { say_dada }.should == "waaaa"
|
37
|
-
ask(Baby.new) { say_dada }.should == "waaaa"
|
38
|
-
|
39
|
-
ask Baby.new, :to do
|
40
|
-
say_dada
|
41
|
-
end
|
42
|
-
|
43
|
-
to_say_dada = proc { say_dada }
|
44
|
-
Object.new.ask(Baby.new, to_say_dada).should == "waaaa"
|
45
|
-
Object.ask(Baby.new, to_say_dada).should == "waaaa"
|
46
|
-
ask(Baby.new, to_say_dada).should == "waaaa"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "#teach" do
|
51
|
-
it "should run the given block or proc inside the requested object closure" do
|
52
|
-
class Baby
|
53
|
-
def say_dada
|
54
|
-
"waaaa"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
Object.new.teach(Baby.new) { say_dada }.should == "waaaa"
|
59
|
-
Object.teach(Baby.new) { say_dada }.should == "waaaa"
|
60
|
-
teach(Baby.new) { say_dada }.should == "waaaa"
|
61
|
-
|
62
|
-
teach Baby.new, :to do
|
63
|
-
say_dada
|
64
|
-
end
|
65
26
|
|
66
|
-
to_say_dada = proc { say_dada }
|
67
|
-
Object.new.teach(Baby.new, to_say_dada).should == "waaaa"
|
68
|
-
Object.teach(Baby.new, to_say_dada).should == "waaaa"
|
69
|
-
teach(Baby.new, to_say_dada).should == "waaaa"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
describe "#beg" do
|
75
|
-
it "should run the given block or proc inside the requested object closure" do
|
76
|
-
class Baby
|
77
|
-
def say_dada
|
78
|
-
"waaaa"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
Object.new.beg(Baby.new) { say_dada }.should == "waaaa"
|
83
|
-
Object.beg(Baby.new) { say_dada }.should == "waaaa"
|
84
|
-
beg(Baby.new) { say_dada }.should == "waaaa"
|
85
|
-
|
86
|
-
beg Baby.new, :to do
|
87
|
-
say_dada
|
88
|
-
end
|
89
|
-
|
90
|
-
to_say_dada = proc { say_dada }
|
91
|
-
Object.new.beg(Baby.new, to_say_dada).should == "waaaa"
|
92
|
-
Object.beg(Baby.new, to_say_dada).should == "waaaa"
|
93
|
-
beg(Baby.new, to_say_dada).should == "waaaa"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
27
|
describe "##bind" do
|
99
28
|
it "should create a new instance method that evaluates the block passed it within the requested closure" do
|
100
29
|
proc do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Parker
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-23 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|