class RubyParserStuff::Environment
Attributes
dyn[R]
env[R]
Public Class Methods
new(dyn = false)
click to toggle source
# File lib/ruby_parser_extras.rb, line 1813 def initialize dyn = false @dyn = [] @env = [] self.reset end
Public Instance Methods
[](k)
click to toggle source
# File lib/ruby_parser_extras.rb, line 1790 def [] k self.all[k] end
[]=(k, v)
click to toggle source
# File lib/ruby_parser_extras.rb, line 1794 def []= k, v raise "no" if v == true self.current[k] = v end
all()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1799 def all idx = @dyn.index(false) || 0 @env[0..idx].reverse.inject { |env, scope| env.merge scope } end
current()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1804 def current @env.first end
extend(dyn = false)
click to toggle source
# File lib/ruby_parser_extras.rb, line 1808 def extend dyn = false @dyn.unshift dyn @env.unshift({}) end
reset()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1819 def reset @dyn.clear @env.clear self.extend end def unextend @dyn.shift @env.shift raise "You went too far unextending env" if @env.empty? end end
unextend()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1825 def unextend @dyn.shift @env.shift raise "You went too far unextending env" if @env.empty? end