class Mustache::Context
def find_in_hash(obj, key, default)
def find_in_hash(obj, key, default) return obj[key] if obj.has_key?(key) return obj[key.to_s] if obj.has_key?(key.to_s) # If default is :__missing then we are from #fetch which is hunting through the stack # If default is nil then we are reducing dot notation if :__missing != default && mustache_in_stack.raise_on_context_miss? raise ContextMiss.new("Can't find #{key} in #{obj}") else obj.fetch(key, default) end end