Class: Aldous::Controller::Action::Precondition
- Inherits:
-
Object
- Object
- Aldous::Controller::Action::Precondition
- Includes:
- Aldous
- Defined in:
- lib/aldous/controller/action/precondition.rb,
lib/aldous/controller/action/precondition/wrapper.rb
Defined Under Namespace
Classes: Wrapper
Constant Summary
Constants included from Aldous
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#view_builder ⇒ Object
readonly
Returns the value of attribute view_builder.
Class Method Summary collapse
- .build(action, controller, view_builder) ⇒ Object
- .inherited(klass) ⇒ Object
- .perform(action, controller, view_builder) ⇒ Object
Instance Method Summary collapse
-
#build_view(respondable_class, extra_data = {}) ⇒ Object
NOTE deprecated.
-
#initialize(action, controller, view_builder) ⇒ Precondition
constructor
A new instance of Precondition.
- #perform ⇒ Object
Methods included from Aldous
Constructor Details
#initialize(action, controller, view_builder) ⇒ Precondition
Returns a new instance of Precondition.
31 32 33 34 35 |
# File 'lib/aldous/controller/action/precondition.rb', line 31 def initialize(action, controller, view_builder) @action = action @controller = controller @view_builder = view_builder end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
29 30 31 |
# File 'lib/aldous/controller/action/precondition.rb', line 29 def action @action end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
29 30 31 |
# File 'lib/aldous/controller/action/precondition.rb', line 29 def controller @controller end |
#view_builder ⇒ Object (readonly)
Returns the value of attribute view_builder.
29 30 31 |
# File 'lib/aldous/controller/action/precondition.rb', line 29 def view_builder @view_builder end |
Class Method Details
.build(action, controller, view_builder) ⇒ Object
10 11 12 |
# File 'lib/aldous/controller/action/precondition.rb', line 10 def build(action, controller, view_builder) Aldous::Controller::Action::Precondition::Wrapper.new(new(action, controller, view_builder)) end |
.inherited(klass) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/aldous/controller/action/precondition.rb', line 18 def inherited(klass) ::Aldous.configuration.controller_methods_exposed_to_action.each do |method_name| unless klass.method_defined?(method_name) define_method method_name do controller.send(method_name) end end end end |
.perform(action, controller, view_builder) ⇒ Object
14 15 16 |
# File 'lib/aldous/controller/action/precondition.rb', line 14 def perform(action, controller, view_builder) build(action, controller, view_builder).perform end |
Instance Method Details
#build_view(respondable_class, extra_data = {}) ⇒ Object
NOTE deprecated
44 45 46 |
# File 'lib/aldous/controller/action/precondition.rb', line 44 def build_view(respondable_class, extra_data = {}) # deprecated view_builder.build(respondable_class, extra_data) end |
#perform ⇒ Object
37 38 39 |
# File 'lib/aldous/controller/action/precondition.rb', line 37 def perform raise NotImplementedError.new("#{self.class.name} must implement method #perform") end |