Module: Charcoal::JSONP::ClassMethods

Includes:
ControllerFilter
Defined in:
lib/charcoal/jsonp.rb

Instance Method Summary collapse

Methods included from ControllerFilter

included

Instance Method Details

#jsonp_allowedObject



17
18
19
# File 'lib/charcoal/jsonp.rb', line 17

def jsonp_allowed
  @jsonp_allowed ||= Hash.new(lambda { |_| false })
end

#jsonp_allowed?(instance, action) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/charcoal/jsonp.rb', line 25

def jsonp_allowed?(instance, action)
  jsonp_allowed[action.to_sym].try(:call, instance) ||
    (action != :all && jsonp_allowed?(instance, :all))
end