Module: Trxl::EnvFunction1

Defined in:
lib/trxl/trxl_grammar.rb

Instance Method Summary collapse

Instance Method Details

#eval(env = Environment.new) ⇒ Object



5119
5120
5121
5122
5123
5124
5125
5126
5127
# File 'lib/trxl/trxl_grammar.rb', line 5119

def eval(env = Environment.new)
  if range_literal.range_type(env) == :string
    env_range = range_literal.eval(env)
    #Hash[*(env.select{ |k,v|  env_range.include?(k.to_s) }).flatten]
    env.select{ |k,v|  env_range.include?(k.to_s) }.map { |pair| pair[1] }
  else
    raise Trxl::InvalidOperationException, "ENV range not of type String"
  end
end