casting 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cca3576453e1acf20799cd80afe5a2e9e4c39cc
4
- data.tar.gz: f892e78276d01554fa159d893507c61fcb4dcf37
3
+ metadata.gz: b2c87cd8917d7140a16d55d487f4f0999ee44824
4
+ data.tar.gz: 2ffb23af2a79836b0705efe5aa8ac00df0144881
5
5
  SHA512:
6
- metadata.gz: 68f289b4009fd5330f856fda1ce71f190ab8317fbf0aa343b9b4244afc6bcdb613be34457c3b98ceb120b620e889511b285099d1006cd6f679be874a6a0a1251
7
- data.tar.gz: 75e7c54b13bad49081fd15597adc4891f3ebfdb5c66b423b0278ecbfd8a3dd48ff22ab1fcc6a2b40b7dae19a29d5e31d1a5a3b1a0986f9250c67e2c3c52c3950
6
+ metadata.gz: 82e5c33d84c41df11ead6966456bd8b42d0f665c0ba50345ba9b5fa3241dd4b42eaf74a9cd6c08b6212007b7ca1d009f8fe4a6c41a76a1a81ace87e2800be759
7
+ data.tar.gz: 502e4254feb758ddff742e3296eed05282b7690d5dda8ab530475da871603db0f3926a31150edcc4140120035ac1f06e059c000b8dbff4eda9337fa81a132bea
@@ -65,6 +65,7 @@ module Casting
65
65
 
66
66
  def method_delegate(meth)
67
67
  __delegates__.find{|attendant|
68
+ attendant.respond_to?(:method_defined?) && attendant.method_defined?(meth) ||
68
69
  attendant_methods(attendant).include?(meth)
69
70
  }
70
71
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Casting
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
@@ -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.0
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-26 00:00:00.000000000 Z
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.