Class: Forms::CollectionLabel
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- Forms::CollectionLabel
- Defined in:
- lib/forms/collection_label.rb
Overview
A label for a single collection checkbox item.
Instance Method Summary collapse
-
#initialize(for_id:, text:, **options, &block) ⇒ CollectionLabel
constructor
A new instance of CollectionLabel.
- #view_template ⇒ Object
Constructor Details
#initialize(for_id:, text:, **options, &block) ⇒ CollectionLabel
Returns a new instance of CollectionLabel.
6 7 8 9 10 11 12 |
# File 'lib/forms/collection_label.rb', line 6 def initialize(for_id:, text:, **, &block) @for_id = for_id @text = text @options = @block = block super() end |
Instance Method Details
#view_template ⇒ Object
14 15 16 17 18 |
# File 'lib/forms/collection_label.rb', line 14 def view_template label(for: @for_id, class: @options[:class]) do @block ? yield_content(&@block) : plain(@text) end end |