aboutsummaryrefslogtreecommitdiff
path: root/ruby/env.rb
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-10 22:24:58 -0500
committerJoel Martin <github@martintribe.org>2014-04-10 22:24:58 -0500
commit8bf53bec72d27d7d895b39812ffae1e990425158 (patch)
treea658f2900b9ceff44522780b3d5c28afb1abf0e2 /ruby/env.rb
parentb5f469de182a3e95b2d968ddccf2e2f9b77a3dc2 (diff)
downloadmal-8bf53bec72d27d7d895b39812ffae1e990425158.tar.gz
mal-8bf53bec72d27d7d895b39812ffae1e990425158.zip
Ruby: step4_if_fn_do with core functions.
Diffstat (limited to 'ruby/env.rb')
-rw-r--r--ruby/env.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/ruby/env.rb b/ruby/env.rb
index dfd5ec9..97dfa13 100644
--- a/ruby/env.rb
+++ b/ruby/env.rb
@@ -3,6 +3,15 @@ class Env
def initialize(outer=nil, binds=[], exprs=[])
@data = {}
@outer = outer
+ binds.each_index do |i|
+ if binds[i] == :"&"
+ data[binds[i+1]] = exprs.drop(i)
+ break
+ else
+ data[binds[i]] = exprs[i]
+ end
+ end
+ return self
end
def find(key)