Class: StimulusPlumbers::Components::Card::Slots
- Inherits:
-
Plumber::Slots
- Object
- Plumber::Slots
- StimulusPlumbers::Components::Card::Slots
- Defined in:
- lib/stimulus_plumbers/components/card/slots.rb
Instance Method Summary collapse
-
#with_action(value = nil, url: nil, &block) ⇒ Object
Defined manually (not via ‘slot` DSL) because it requires a named `url:` keyword with validation.
- #with_body(&block) ⇒ Object
Methods inherited from Plumber::Slots
#any?, #initialize, #none?, #options_for, #resolve, slot
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Slots
Instance Method Details
#with_action(value = nil, url: nil, &block) ⇒ Object
Defined manually (not via ‘slot` DSL) because it requires a named `url:` keyword with validation.
17 18 19 20 21 22 |
# File 'lib/stimulus_plumbers/components/card/slots.rb', line 17 def with_action(value = nil, url: nil, &block) raise ArgumentError, "card.action requires content (string or block) when url: is given" if url && value.nil? && !block set_slot(:action, block || value, url ? { url: url } : {}) nil end |
#with_body(&block) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/stimulus_plumbers/components/card/slots.rb', line 9 def with_body(&block) raise ArgumentError, "card.body requires a block" unless block set_slot(:body, block) nil end |