refr 0.0.1 → 0.0.2

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 +7 -9
  2. metadata +1 -1
data/lib/refr.rb CHANGED
@@ -11,11 +11,13 @@
11
11
  #++
12
12
 
13
13
  class Reference < BasicObject
14
- Environment = ::Class.new(::BasicObject) {
15
- def method_missing (id, *args, &block)
16
- id
17
- end
18
- }.new
14
+ def self.local (&block)
15
+ self.new(block.call, block.binding)
16
+ end
17
+
18
+ def self.[] (value)
19
+ self.local { :value }
20
+ end
19
21
 
20
22
  def initialize (name, vars)
21
23
  @getter = ::Kernel::eval("lambda { #{name} }", vars)
@@ -38,7 +40,3 @@ class Reference < BasicObject
38
40
  end
39
41
  end
40
42
  end
41
-
42
- def ref (&block)
43
- Reference.new(Reference::Environment.instance_eval(&block), block.binding)
44
- end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - meh.