Class: RespondForHelper::Formats::Base
- Inherits:
-
Object
- Object
- RespondForHelper::Formats::Base
- Defined in:
- lib/respond_for_helper/formats/base.rb
Instance Attribute Summary collapse
-
#behaviour ⇒ Object
readonly
Returns the value of attribute behaviour.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(controller, item, success, options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(controller, item, success, options) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 |
# File 'lib/respond_for_helper/formats/base.rb', line 11 def initialize(controller, item, success, ) @controller = controller @item = item @result = success ? :success : :failure @options = @format = self.class.format.to_sym @behaviour = Behaviours.new(@controller, @format, @result, @options).call end |
Instance Attribute Details
#behaviour ⇒ Object (readonly)
Returns the value of attribute behaviour.
8 9 10 |
# File 'lib/respond_for_helper/formats/base.rb', line 8 def behaviour @behaviour end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
8 9 10 |
# File 'lib/respond_for_helper/formats/base.rb', line 8 def controller @controller end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
8 9 10 |
# File 'lib/respond_for_helper/formats/base.rb', line 8 def format @format end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
8 9 10 |
# File 'lib/respond_for_helper/formats/base.rb', line 8 def item @item end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/respond_for_helper/formats/base.rb', line 8 def result @result end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/respond_for_helper/formats/base.rb', line 21 def call if respond_to?("_#{action_name}", true) send("_#{action_name}") else perform end end |