Module: Charcoal::CrossOrigin::ClassMethods

Includes:
Charcoal::ControllerFilter
Defined in:
lib/charcoal/cross_origin.rb

Instance Method Summary collapse

Methods included from Charcoal::ControllerFilter

included

Instance Method Details

#cors_allowedObject



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

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

#cors_allowed?(instance, action) ⇒ Boolean

Returns:

  • (Boolean)


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

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