Class: LiveComponent::Target
- Inherits:
-
Object
- Object
- LiveComponent::Target
- Defined in:
- lib/live_component/target.rb
Class Method Summary collapse
Instance Method Summary collapse
- #attr_name ⇒ Object
-
#initialize(controller_name, target_name) ⇒ Target
constructor
A new instance of Target.
- #to_attributes ⇒ Object
Constructor Details
#initialize(controller_name, target_name) ⇒ Target
Returns a new instance of Target.
5 6 7 8 |
# File 'lib/live_component/target.rb', line 5 def initialize(controller_name, target_name) @controller_name = controller_name @target_name = target_name end |
Class Method Details
.attr_name ⇒ Object
14 15 16 |
# File 'lib/live_component/target.rb', line 14 def self.attr_name :targets end |
Instance Method Details
#attr_name ⇒ Object
18 19 20 |
# File 'lib/live_component/target.rb', line 18 def attr_name self.class.attr_name end |
#to_attributes ⇒ Object
10 11 12 |
# File 'lib/live_component/target.rb', line 10 def to_attributes { "data-#{@controller_name}-target": @target_name.to_s } end |