Class: AtomicView::Components::ButtonComponent
- Inherits:
-
ViewComponent::Form::ButtonComponent
- Object
- ViewComponent::Form::ButtonComponent
- AtomicView::Components::ButtonComponent
- Defined in:
- lib/atomic_view/components/button_component.rb
Overview
Button
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(form, label_or_options = nil, options = nil) ⇒ ButtonComponent
constructor
A new instance of ButtonComponent.
Constructor Details
#initialize(form, label_or_options = nil, options = nil) ⇒ ButtonComponent
Returns a new instance of ButtonComponent.
9 10 11 12 13 14 15 |
# File 'lib/atomic_view/components/button_component.rb', line 9 def initialize(form, = nil, = nil) super if .is_a?(String) @label = end end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/atomic_view/components/button_component.rb', line 7 def label @label end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/atomic_view/components/button_component.rb', line 17 def call if content? content_tag(:button, @options) { content } else content_tag(:button, label, @options) end end |