Class: ResourceController::ActionOptions
- Inherits:
-
Object
- Object
- ResourceController::ActionOptions
- Extended by:
- Accessors
- Defined in:
- lib/resource_controller/action_options.rb
Instance Method Summary collapse
- #dup ⇒ Object
-
#initialize ⇒ ActionOptions
constructor
A new instance of ActionOptions.
- #response(*args, &block) ⇒ Object (also: #respond_to, #responds_to)
- #wants ⇒ Object
Constructor Details
#initialize ⇒ ActionOptions
Returns a new instance of ActionOptions.
10 11 12 |
# File 'lib/resource_controller/action_options.rb', line 10 def initialize @collector = ResourceController::ResponseCollector.new end |
Instance Method Details
#dup ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/resource_controller/action_options.rb', line 30 def dup returning self.class.new do |duplicate| duplicate.instance_variable_set(:@collector, wants.dup) duplicate.instance_variable_set(:@before, before.dup) unless before.nil? duplicate.instance_variable_set(:@after, after.dup) unless after.nil? duplicate.instance_variable_set(:@flash, flash.dup) unless flash.nil? duplicate.instance_variable_set(:@flash_now, flash_now.dup) unless flash_now.nil? end end |
#response(*args, &block) ⇒ Object Also known as: respond_to, responds_to
14 15 16 17 18 19 20 21 22 |
# File 'lib/resource_controller/action_options.rb', line 14 def response(*args, &block) if !args.empty? || block_given? @collector.clear args.flatten.each { |symbol| @collector.send(symbol) } block.call(@collector) if block_given? end @collector.responses end |
#wants ⇒ Object
26 27 28 |
# File 'lib/resource_controller/action_options.rb', line 26 def wants @collector end |