Class: Vident::StimulusAction

Inherits:
StimulusAttributeBase show all
Defined in:
lib/vident/stimulus_action.rb

Instance Attribute Summary collapse

Attributes inherited from StimulusAttributeBase

#implied_controller

Instance Method Summary collapse

Methods inherited from StimulusAttributeBase

#implied_controller_name, #implied_controller_path, #initialize, #inspect, #to_h

Constructor Details

This class inherits a constructor from Vident::StimulusAttributeBase

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



5
6
7
# File 'lib/vident/stimulus_action.rb', line 5

def action
  @action
end

#controllerObject (readonly)

Returns the value of attribute controller.



5
6
7
# File 'lib/vident/stimulus_action.rb', line 5

def controller
  @controller
end

#eventObject (readonly)

Returns the value of attribute event.



5
6
7
# File 'lib/vident/stimulus_action.rb', line 5

def event
  @event
end

Instance Method Details

#data_attribute_nameObject



15
16
17
# File 'lib/vident/stimulus_action.rb', line 15

def data_attribute_name
  "action"
end

#data_attribute_valueObject



19
20
21
# File 'lib/vident/stimulus_action.rb', line 19

def data_attribute_value
  to_s
end

#to_sObject



7
8
9
10
11
12
13
# File 'lib/vident/stimulus_action.rb', line 7

def to_s
  if @event
    "#{@event}->#{@controller}##{@action}"
  else
    "#{@controller}##{@action}"
  end
end