class Jbuilder::Jpartial::JbuilderProxy

Partial method execution is defined here. Jbuilder only knows how to initialize an instance of the proxy class and send it the right message. The proxy is initialized with the execution context if there is any so it can pass along context methods when they're defined.

Attributes

json[R]

Public Class Methods

new(json, context = nil) click to toggle source
# File lib/jbuilder/jpartial.rb, line 64
def initialize(json, context = nil)
  @json    = json
  @context = context
end

Public Instance Methods

_method_defined_in_context?(method_name) click to toggle source
# File lib/jbuilder/jpartial.rb, line 77
def _method_defined_in_context?(method_name)
  !@context.nil? && @context.respond_to?(method_name)
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/jbuilder/jpartial.rb, line 69
def method_missing(method_name, *args, &block)
  if _method_defined_in_context?(method_name)
    @context.send(method_name, *args, &block)
  else
    super(method_name, *args, &block)
  end
end