refr 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/refr.rb +18 -8
- metadata +2 -2
data/lib/refr.rb
CHANGED
@@ -11,15 +11,25 @@
|
|
11
11
|
#++
|
12
12
|
|
13
13
|
class Reference
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
class << self
|
15
|
+
def normalize (value)
|
16
|
+
if (value.___is_a_reference___ rescue false)
|
17
|
+
value.__get_referenced__
|
18
|
+
else
|
19
|
+
value
|
20
|
+
end
|
21
|
+
end; alias - normalize
|
22
|
+
|
23
|
+
def local (&block)
|
24
|
+
self.new(block.call, block.binding)
|
25
|
+
end
|
17
26
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
27
|
+
def [] (value, force=false)
|
28
|
+
if (value.___is_a_reference___ rescue false) && !force
|
29
|
+
value
|
30
|
+
else
|
31
|
+
self.local { :value }
|
32
|
+
end
|
23
33
|
end
|
24
34
|
end
|
25
35
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- meh.
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-27 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description:
|