class Ruhoh::Views::RMustache::RContext

Public Instance Methods

find(obj, key, default = nil) click to toggle source

Overload find method to catch helper expressions

Calls superclass method
# File lib/ruhoh/views/rmustache.rb, line 6
def find(obj, key, default = nil)
  return super unless key.to_s.index('?')
  keys = key.to_s.split('?')
  context = keys[0]
  helpers = keys[1..-1]
  context = context.empty? ? obj : super(obj, context)
  
  helpers.each do |helper|
    context = self.mustache_in_stack.__send__ helper, context
  end
  context
end