Class: RespondForHelper::Behaviours

Inherits:
Object
  • Object
show all
Defined in:
lib/respond_for_helper/behaviour.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller, format, result, options) ⇒ Behaviours

Returns a new instance of Behaviours.



35
36
37
38
39
40
41
42
43
# File 'lib/respond_for_helper/behaviour.rb', line 35

def initialize(controller, format, result, options)
  @controller = controller
  @format = format
  @result = result
  @options = options

  @controller_behaviours = @controller.respond_for_config.fetch(:behaviours, {})
  @default_behaviours = Config.behaviours
end

Instance Method Details

#callObject



45
46
47
48
49
50
51
52
53
54
# File 'lib/respond_for_helper/behaviour.rb', line 45

def call
  behaviour = Behaviour.new(resolve_attributes)

  if @format == :html
    merge_html_options(behaviour)
    merge_flash_options(behaviour)
  end

  behaviour
end