lib/bindata/base.rb in bindata-1.4.0 vs lib/bindata/base.rb in bindata-1.4.1
- old
+ new
@@ -127,10 +127,20 @@
# +overrides+ is an optional +parameters+ like hash that allow the
# parameters given at object construction to be overridden.
#
# Returns nil if +key+ does not refer to any parameter.
def eval_parameter(key, overrides = nil)
- LazyEvaluator.eval(self, get_parameter(key), overrides)
+ value = get_parameter(key)
+ if value.is_a?(Symbol) or value.respond_to?(:arity)
+ lazy_evaluator.lazy_eval(value, overrides)
+ else
+ value
+ end
+ end
+
+ # Returns a lazy evaluator for this object.
+ def lazy_evaluator #:nodoc:
+ @lazy ||= LazyEvaluator.new(self)
end
# Returns the parameter referenced by +key+.
# Use this method if you are sure the parameter is not to be evaluated.
# You most likely want #eval_parameter.