Module: Dicer::ActionController::ClassMethods

Defined in:
lib/dicer/railtie/action_controller.rb

Instance Method Summary collapse

Instance Method Details

#context_for(action, context_class = nil, &context_define) ⇒ Object



18
19
20
21
22
# File 'lib/dicer/railtie/action_controller.rb', line 18

def context_for(action, context_class = nil, &context_define)
  context = context_class || Class.new(Dicer::Context, &context_define)

  default_contexts[action.to_s.to_sym] = context
end

#default_contextsObject



24
25
26
27
28
29
30
31
# File 'lib/dicer/railtie/action_controller.rb', line 24

def default_contexts
  @default_contexts ||= {}.tap do |hash|
    begin
      hash.default = ::ApplicationContext
    rescue NameError
    end
  end
end