Parent

RubyParser::Environment

Attributes

dyn[R]
env[R]

Public Class Methods

new(dyn = false) click to toggle source
# File lib/ruby_parser_extras.rb, line 930
def initialize dyn = false
  @dyn = []
  @env = []
  @use = []
  self.reset
end

Public Instance Methods

[](k) click to toggle source
# File lib/ruby_parser_extras.rb, line 897
def [] k
  self.all[k]
end
[]=(k, v) click to toggle source
# File lib/ruby_parser_extras.rb, line 901
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 906
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 911
def current
  @env.first
end
dynamic() click to toggle source
# File lib/ruby_parser_extras.rb, line 915
def dynamic
  idx = @dyn.index false
  @env[0...idx].reverse.inject { |env, scope| env.merge scope } || {}
end
dynamic?() click to toggle source
# File lib/ruby_parser_extras.rb, line 920
def dynamic?
  @dyn[0] != false
end
extend(dyn = false) click to toggle source
# File lib/ruby_parser_extras.rb, line 924
def extend dyn = false
  @dyn.unshift dyn
  @env.unshift({})
  @use.unshift({})
end
reset() click to toggle source
# File lib/ruby_parser_extras.rb, line 937
def reset
  @dyn.clear
  @env.clear
  @use.clear
  self.extend
end
unextend() click to toggle source
# File lib/ruby_parser_extras.rb, line 944
def unextend
  @dyn.shift
  @env.shift
  @use.shift
  raise "You went too far unextending env" if @env.empty?
end
use(id) click to toggle source
# File lib/ruby_parser_extras.rb, line 951
def use id
  @env.each_with_index do |env, i|
    if env[id] then
      @use[i][id] = true
    end
  end
end
used?(id) click to toggle source
# File lib/ruby_parser_extras.rb, line 959
def used? id
  idx = @dyn.index false # REFACTOR
  u = @use[0...idx].reverse.inject { |env, scope| env.merge scope } || {}
  u[id]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.