Class: AtomicView::Components::ButtonComponent

Inherits:
ViewComponent::Form::ButtonComponent
  • Object
show all
Defined in:
lib/atomic_view/components/button_component.rb

Overview

Button

Instance Attribute Summary collapse

Instance Method Summary collapse

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, label_or_options = nil, options = nil)
  super

  if label_or_options.is_a?(String)
    @label = label_or_options
  end
end

Instance Attribute Details

#labelObject (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

#callObject



17
18
19
20
21
22
23
# File 'lib/atomic_view/components/button_component.rb', line 17

def call
  if content?
    (:button, @options) { content }
  else
    (:button, label, @options)
  end
end