Class: ResourceController::ActionOptions

Inherits:
Object
  • Object
show all
Extended by:
Accessors
Defined in:
lib/resource_controller/action_options.rb

Instance Method Summary collapse

Constructor Details

#initializeActionOptions

Returns a new instance of ActionOptions.



8
9
10
# File 'lib/resource_controller/action_options.rb', line 8

def initialize
  @collector = ResourceController::ResponseCollector.new
end

Instance Method Details

#response(*args, &block) ⇒ Object Also known as: respond_to, responds_to



12
13
14
15
16
17
18
19
20
# File 'lib/resource_controller/action_options.rb', line 12

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

#wantsObject



24
25
26
# File 'lib/resource_controller/action_options.rb', line 24

def wants
  @collector
end