ripar 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ripar/roller.rb +4 -4
- data/lib/ripar/version.rb +1 -1
- data/spec/roller_spec.rb +20 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b01bc5af736ac56ae5e2bb456fe291fad402f36
|
4
|
+
data.tar.gz: 00546f076c94b527597006ae6b1b0a38d706277e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10398f5c038672aad9ef581aea3711ee85fee643388f7f064606b24b613bf1c166d7c63ab04a140b16066c989d174bf24b2122316644ecd399d5eef02b82c744
|
7
|
+
data.tar.gz: 807a2d4a65fcae43460ccf2380a9dc2ccfc33b88fe72c795173ebce957681b611c52e3dc46038635359f6f9b042b566d32163be95c6e91adbff753117a3418c9
|
data/lib/ripar/roller.rb
CHANGED
@@ -68,7 +68,7 @@ class Ripar::Roller < BasicObject
|
|
68
68
|
# no point in using respond_to_missing?, because that's part of Object#respond_to,
|
69
69
|
# not BasicObject
|
70
70
|
def respond_to?( meth, include_all = false )
|
71
|
-
@riven.respond_to?(meth, include_all) || __methods__.include?(meth)
|
71
|
+
@riven.respond_to?(meth, include_all) || __methods__(include_all).include?(meth) || __singleton_methods__(include_all).include?(meth)
|
72
72
|
end
|
73
73
|
|
74
74
|
# make sure this BasicObject plays nicely in pry
|
@@ -85,6 +85,7 @@ class Ripar::Roller < BasicObject
|
|
85
85
|
# include useful methods from Kernel, but rename
|
86
86
|
define_method :__class__, ::Kernel.instance_method(:class)
|
87
87
|
define_method :__object_id__, ::Kernel.instance_method(:object_id)
|
88
|
+
define_method :__singleton_methods__, ::Kernel.instance_method(:singleton_methods)
|
88
89
|
|
89
90
|
protected
|
90
91
|
|
@@ -100,8 +101,7 @@ protected
|
|
100
101
|
end
|
101
102
|
|
102
103
|
private
|
103
|
-
|
104
|
-
|
105
|
-
self.__class__.instance_methods
|
104
|
+
def __methods__( include_all = true )
|
105
|
+
self.__class__.instance_methods include_all
|
106
106
|
end
|
107
107
|
end
|
data/lib/ripar/version.rb
CHANGED
data/spec/roller_spec.rb
CHANGED
@@ -267,4 +267,24 @@ describe Ripar::Roller do
|
|
267
267
|
collection.roller.riven.object_id.should_not == collection.object_id
|
268
268
|
end
|
269
269
|
end
|
270
|
+
|
271
|
+
describe '#respond_to?' do
|
272
|
+
it 'forwarded methods' do
|
273
|
+
rlr = collection.roller
|
274
|
+
rlr.should respond_to(:to_a)
|
275
|
+
end
|
276
|
+
|
277
|
+
it 'Roller methods' do
|
278
|
+
rlr = collection.roller
|
279
|
+
rlr.should respond_to(:riven)
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'singleton methods' do
|
283
|
+
rlr = collection.roller
|
284
|
+
class << rlr
|
285
|
+
def bergle; riven end
|
286
|
+
end
|
287
|
+
rlr.should respond_to(:bergle)
|
288
|
+
end
|
289
|
+
end
|
270
290
|
end
|