Class: DaisyUI::Validator
- Defined in:
- lib/daisy_ui/validator.rb
Constant Summary
Constants inherited from Base
Base::BOOLS, Base::COLOR_MODIFIERS
Instance Method Summary collapse
- #hint(**options, &block) ⇒ Object
-
#initialize(as: :input) ⇒ Validator
constructor
A new instance of Validator.
- #view_template(&block) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(as: :input) ⇒ Validator
Returns a new instance of Validator.
8 9 10 |
# File 'lib/daisy_ui/validator.rb', line 8 def initialize(*, as: :input, **) super end |
Instance Method Details
#hint(**options, &block) ⇒ Object
21 22 23 |
# File 'lib/daisy_ui/validator.rb', line 21 def hint(**, &block) @hint = -> { p(class: component_classes("validator-hint", options:), **, &block) } end |
#view_template(&block) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/daisy_ui/validator.rb', line 12 def view_template(&block) block&.call(self) public_send(as, class: classes, **attributes) # Render hint if it was set @hint&.call end |