casting 0.6.5 → 0.6.6

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: 053778d6e1b80af5e267c189ecfe145f453c8f6d
4
- data.tar.gz: 9f0fdfbe82cda37f8c17421cf63f4c4f794680e6
3
+ metadata.gz: da160756c7cff2e170c043b6c2d7ae07f9a7371c
4
+ data.tar.gz: 9de07d8f49befa9d26204725323295078eb4d271
5
5
  SHA512:
6
- metadata.gz: a0a6a89aab3638e817ff4c57d91bac7cec21519c0697d3aa3237f40fe5be7fb93881acbdf82eceedc8a7af70a3e8505627b09591ab5debc89c15573d9201b29d
7
- data.tar.gz: 0e93c438e769f07061be8b45b0d766b87a44e9634a5ea513162bf0fadb9d224f0c212e0d4d98bbda11b1d54b4b116596b1f5c33d8500b4a95f967b8fe2c2c648
6
+ metadata.gz: e28a7b18d312c8e341293c7c0654564b8dd1ce6fd06fd2950ca43cf66b700ecb76ae1d9654dc6aa01cd6433bae9db06677e29abd26183b79fcfc5ec6edfa7a1d
7
+ data.tar.gz: 839c8de909e12c87a68184542db35a0eb9b6498dff6922019cc50129b4c97c5acab29746d16722c661a4c26cd5263a78b26b6c8e23ac08f60dd391563e0ae7fa
@@ -5,12 +5,14 @@ module Casting
5
5
 
6
6
  def cast_as(attendant)
7
7
  validate_attendant(attendant)
8
+ attendant.cast_object(self) if attendant.respond_to?(:cast_object)
8
9
  __delegates__.unshift(attendant)
9
10
  self
10
11
  end
11
12
 
12
13
  def uncast
13
- __delegates__.shift
14
+ attendant = __delegates__.shift
15
+ attendant.uncast_object(self) if attendant.respond_to?(:uncast_object)
14
16
  self
15
17
  end
16
18
 
@@ -1,12 +1,14 @@
1
1
  # Some features are only available in versions of Ruby
2
2
  # where this method is true
3
- def module_method_rebinding?
4
- return @__module_method_rebinding__ if defined?(@__module_method_rebinding__)
5
- sample_method = Enumerable.instance_method(:to_a)
6
- @__module_method_rebinding__ = begin
7
- !!sample_method.bind(Object.new)
8
- rescue TypeError
9
- false
3
+ unless defined?(self.module_method_rebinding?)
4
+ def module_method_rebinding?
5
+ return @__module_method_rebinding__ if defined?(@__module_method_rebinding__)
6
+ sample_method = Enumerable.instance_method(:to_a)
7
+ @__module_method_rebinding__ = begin
8
+ !!sample_method.bind(Object.new)
9
+ rescue TypeError
10
+ false
11
+ end
10
12
  end
11
13
  end
12
14
 
@@ -1,3 +1,3 @@
1
1
  module Casting
2
- VERSION = '0.6.5'
2
+ VERSION = '0.6.6'
3
3
  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.6.5
4
+ version: 0.6.6
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-01-09 00:00:00.000000000 Z
11
+ date: 2014-02-08 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.