Class: ActiveResponse::Responders::Base
- Inherits:
-
Object
- Object
- ActiveResponse::Responders::Base
- Defined in:
- lib/active_response/responders/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#format ⇒ Object
Returns the value of attribute format.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(controller, format) ⇒ Base
constructor
A new instance of Base.
- #type ⇒ Object
Constructor Details
#initialize(controller, format) ⇒ Base
Returns a new instance of Base.
12 13 14 15 |
# File 'lib/active_response/responders/base.rb', line 12 def initialize(controller, format) self.controller = controller self.format = format end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
6 7 8 |
# File 'lib/active_response/responders/base.rb', line 6 def controller @controller end |
#format ⇒ Object
Returns the value of attribute format.
7 8 9 |
# File 'lib/active_response/responders/base.rb', line 7 def format @format end |
Class Method Details
.available_formats ⇒ Object
36 37 38 39 40 |
# File 'lib/active_response/responders/base.rb', line 36 def available_formats return @available_formats if @available_formats.present? @available_formats = ActiveResponse.registered_responders.map(&:formats).flatten.sort { |format| format == :html ? 0 : 1 } end |
.respond_to(*formats) ⇒ Object
28 29 30 |
# File 'lib/active_response/responders/base.rb', line 28 def respond_to(*formats) self.formats = formats end |
.type ⇒ Object
32 33 34 |
# File 'lib/active_response/responders/base.rb', line 32 def type @type ||= name.gsub('Responder', '').underscore.to_sym end |
Instance Method Details
#type ⇒ Object
17 18 19 |
# File 'lib/active_response/responders/base.rb', line 17 def type self.class.type end |