class Build::Environment::Evaluator
Public Class Methods
new(environment)
click to toggle source
# File lib/build/environment/evaluator.rb, line 24 def initialize(environment) @environment = environment @cache = {} end
Public Instance Methods
initialize_dup(other)
click to toggle source
Calls superclass method
# File lib/build/environment/evaluator.rb, line 29 def initialize_dup(other) @environment = other.instance_variable_get(:@environment) @cache = other.instance_variable_get(:@cache).dup super end
method_missing(name)
click to toggle source
# File lib/build/environment/evaluator.rb, line 40 def method_missing(name) @cache[name] ||= object_value(@environment[name]) end
object_value(value)
click to toggle source
Compute the literal object value for a given key:
# File lib/build/environment/evaluator.rb, line 45 def object_value(value) case value when Array value.collect{|item| object_value(item)}.flatten when Symbol object_value(@environment[value]) when Proc object_value(instance_exec(&value)) when Default object_value(value.value) when Replace object_value(value.value) else value end end
respond_to?(name, include_private = false)
click to toggle source
Calls superclass method
# File lib/build/environment/evaluator.rb, line 36 def respond_to?(name, include_private = false) @environment.include?(name) || super end