32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/www_app.rb', line 32
def fetch *args
raise ContextMiss.new("Can't find: #{args.inspect}") if args.size != 2
meth, key = args
@stack.each { |frame|
case
when frame.is_a?(Hash) && meth == :coll && !frame.has_key?(key)
return false
when frame.is_a?(Hash) && meth == :coll && frame.has_key?(key)
target = frame[key]
if target == true || target == false || target == nil || target.is_a?(Array) || target.is_a?(Hash)
return target
end
fail "Invalid value: #{key.inspect} (#{key.class})"
when frame.is_a?(Hash) && frame.has_key?(key)
return ::Escape_Escape_Escape.send(meth, frame[key])
end
}
raise ContextMiss.new("Can't find .#{meth}(#{key.inspect})")
end
|