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.
Files changed (2) hide show
  1. data/lib/refr.rb +6 -2
  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
- @getter = ::Kernel::eval("lambda { #{name} }", vars)
24
- @setter = ::Kernel::eval("lambda { |v| #{name} = v }", vars)
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__
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - meh.