casting 0.6.5 → 0.6.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.
- checksums.yaml +4 -4
- data/lib/casting/missing_method_client.rb +3 -1
- data/lib/casting/prepared_delegation.rb +9 -7
- data/lib/casting/version.rb +1 -1
- 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: da160756c7cff2e170c043b6c2d7ae07f9a7371c
|
4
|
+
data.tar.gz: 9de07d8f49befa9d26204725323295078eb4d271
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
|
data/lib/casting/version.rb
CHANGED
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.
|
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-
|
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.
|