casting 0.7.0 → 0.7.1
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.
- checksums.yaml +4 -4
- data/lib/casting/missing_method_client.rb +1 -0
- data/lib/casting/null.rb +6 -0
- data/lib/casting/version.rb +1 -1
- data/test/null_module_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2c87cd8917d7140a16d55d487f4f0999ee44824
|
4
|
+
data.tar.gz: 2ffb23af2a79836b0705efe5aa8ac00df0144881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82e5c33d84c41df11ead6966456bd8b42d0f665c0ba50345ba9b5fa3241dd4b42eaf74a9cd6c08b6212007b7ca1d009f8fe4a6c41a76a1a81ace87e2800be759
|
7
|
+
data.tar.gz: 502e4254feb758ddff742e3296eed05282b7690d5dda8ab530475da871603db0f3926a31150edcc4140120035ac1f06e059c000b8dbff4eda9337fa81a132bea
|
data/lib/casting/null.rb
CHANGED
@@ -3,11 +3,17 @@ module Casting
|
|
3
3
|
def self.instance_method(name)
|
4
4
|
Empty.instance_method(:null)
|
5
5
|
end
|
6
|
+
def self.method_defined?(meth)
|
7
|
+
true
|
8
|
+
end
|
6
9
|
end
|
7
10
|
module Blank
|
8
11
|
def self.instance_method(name)
|
9
12
|
Empty.instance_method(:blank)
|
10
13
|
end
|
14
|
+
def self.method_defined?(meth)
|
15
|
+
true
|
16
|
+
end
|
11
17
|
end
|
12
18
|
module Empty
|
13
19
|
def null(*args, &block); end
|
data/lib/casting/version.rb
CHANGED
data/test/null_module_test.rb
CHANGED
@@ -18,4 +18,15 @@ describe Casting::Blank do
|
|
18
18
|
|
19
19
|
assert_empty client.delegate('greet', attendant)
|
20
20
|
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "making null objects" do
|
24
|
+
it "answers to missing methods" do
|
25
|
+
client = TestPerson.new
|
26
|
+
client.extend(Casting::Client)
|
27
|
+
client.delegate_missing_methods
|
28
|
+
attendant = Casting::Blank
|
29
|
+
|
30
|
+
assert_respond_to client.cast_as(attendant), 'xyz'
|
31
|
+
end
|
21
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: casting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Gay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Casting assists in method delegation which preserves the binding of 'self' to the object receiving a message.
|