Method: SubContext#method_missing

Defined in:
lib/volt/page/sub_context.rb

#method_missing(method_name, *args, &block) ⇒ Object

Raises:

  • (NoMethodError)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/volt/page/sub_context.rb', line 17

def method_missing(method_name, *args, &block)
  method_name = method_name.to_s
  if @locals.has_key?(method_name)
    obj = @locals[method_name]

    # TODORW: Might get a normal proc, flag internal procs
    if obj.is_a?(Proc)
      obj = obj.call(*args)
    end
    return obj
  elsif @context
    return @context.send(method_name, *args, &block)
  end

  raise NoMethodError.new("undefined method `#{method_name}' for \"#{self.inspect}\":#{self.class.to_s}")
end