Class: StimulusTagHelper::StimulusControllerBuilder
- Inherits:
-
Object
- Object
- StimulusTagHelper::StimulusControllerBuilder
- Defined in:
- lib/stimulus_tag_helper/stimulus_controller_builder.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#tag_options ⇒ Object
readonly
Returns the value of attribute tag_options.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #attributes(**attributes) ⇒ Object
- #capture(&block) ⇒ Object
-
#initialize(identifier:, template:, tag: nil, **tag_options) ⇒ StimulusControllerBuilder
constructor
all the options are tag options of now.
- #properties(**properties) ⇒ Object
Constructor Details
#initialize(identifier:, template:, tag: nil, **tag_options) ⇒ StimulusControllerBuilder
all the options are tag options of now
12 13 14 15 16 17 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 12 def initialize(identifier:, template:, tag: nil, **) @identifier = identifier @template = template @tag = tag @tag_options = end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
9 10 11 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 9 def identifier @identifier end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
9 10 11 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 9 def tag @tag end |
#tag_options ⇒ Object (readonly)
Returns the value of attribute tag_options.
9 10 11 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 9 def @tag_options end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
9 10 11 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 9 def template @template end |
Instance Method Details
#attributes(**attributes) ⇒ Object
41 42 43 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 41 def attributes(**attributes) template.stimulus_attributes(identifier, **attributes) end |
#capture(&block) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 49 def capture(&block) return template.capture(self, &block) unless tag template.stimulus_controller_tag(identifier, tag: tag, **) do template.capture(self, &block) end end |
#properties(**properties) ⇒ Object
45 46 47 |
# File 'lib/stimulus_tag_helper/stimulus_controller_builder.rb', line 45 def properties(**properties) template.stimulus_properties(identifier, **properties) end |