refr 0.0.2 → 0.0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/refr.rb +6 -2
- metadata +1 -1
data/lib/refr.rb
CHANGED
@@ -20,8 +20,12 @@ class Reference < BasicObject
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def initialize (name, vars)
|
23
|
-
|
24
|
-
|
23
|
+
begin
|
24
|
+
@getter = ::Kernel::eval("lambda { #{name} }", vars)
|
25
|
+
@setter = ::Kernel::eval("lambda { |v| #{name} = v }", vars)
|
26
|
+
rescue ::Exception => e
|
27
|
+
::Kernel::raise ::NameError, "#{name} isn't a valid variable name"
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
def __get__
|