Class: RespondForHelper::Behaviour

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

Constant Summary collapse

TYPES =
[:render, :redirect, :head]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Behaviour

Returns a new instance of Behaviour.



9
10
11
12
13
14
15
# File 'lib/respond_for_helper/behaviour.rb', line 9

def initialize(attrs)
  @type = attrs.delete(:type)
  @target = attrs.delete(:target)
  @flash = attrs.delete(:flash)
  @flash_message = attrs.delete(:flash_message)
  @options = attrs
end

Instance Attribute Details

#flashObject

Returns the value of attribute flash.



7
8
9
# File 'lib/respond_for_helper/behaviour.rb', line 7

def flash
  @flash
end

#flash_messageObject

Returns the value of attribute flash_message.



7
8
9
# File 'lib/respond_for_helper/behaviour.rb', line 7

def flash_message
  @flash_message
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/respond_for_helper/behaviour.rb', line 7

def options
  @options
end

#targetObject

Returns the value of attribute target.



7
8
9
# File 'lib/respond_for_helper/behaviour.rb', line 7

def target
  @target
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/respond_for_helper/behaviour.rb', line 7

def type
  @type
end

Instance Method Details

#flash?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/respond_for_helper/behaviour.rb', line 29

def flash?
  @flash
end

#head?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/respond_for_helper/behaviour.rb', line 25

def head?
  @type == :head
end

#redirect?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/respond_for_helper/behaviour.rb', line 21

def redirect?
  @type == :redirect
end

#render?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/respond_for_helper/behaviour.rb', line 17

def render?
  @type == :render
end