Class: Aldous::Controller::Action::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/aldous/controller/action/wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller_action) ⇒ Wrapper

Returns a new instance of Wrapper.



10
11
12
# File 'lib/aldous/controller/action/wrapper.rb', line 10

def initialize(controller_action)
  @controller_action = controller_action
end

Instance Attribute Details

#controller_actionObject (readonly)

Returns the value of attribute controller_action.



8
9
10
# File 'lib/aldous/controller/action/wrapper.rb', line 8

def controller_action
  @controller_action
end

Instance Method Details

#controllerObject



26
27
28
# File 'lib/aldous/controller/action/wrapper.rb', line 26

def controller
  controller_action.controller
end

#default_error_handler(error) ⇒ Object



22
23
24
# File 'lib/aldous/controller/action/wrapper.rb', line 22

def default_error_handler(error)
  controller_action.default_error_handler(error)
end

#default_view_dataObject



18
19
20
# File 'lib/aldous/controller/action/wrapper.rb', line 18

def default_view_data
  controller_action.default_view_data
end

#performObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/aldous/controller/action/wrapper.rb', line 34

def perform
  controller_action.perform
rescue => e
  ::Aldous::LoggingWrapper.log(e)

  error_handler = default_error_handler(e)

  if error_handler.kind_of?(Class) &&
    error_handler.ancestors.include?(Aldous::Respondable::Base)
    view_builder.build(error_handler, errors: [e])
  end
end

#preconditionsObject



14
15
16
# File 'lib/aldous/controller/action/wrapper.rb', line 14

def preconditions
  controller_action.preconditions
end

#view_builderObject



30
31
32
# File 'lib/aldous/controller/action/wrapper.rb', line 30

def view_builder
  controller_action.view_builder
end