Class: ViewComponent::Form::ButtonComponent

Inherits:
BaseComponent show all
Defined in:
app/components/view_component/form/button_component.rb

Instance Attribute Summary collapse

Attributes inherited from BaseComponent

#form, #object_name, #options

Instance Method Summary collapse

Methods inherited from BaseComponent

#html_class, #object_errors, #object_errors?

Methods included from ClassNamesHelper

#build_tag_values, #class_names

Constructor Details

#initialize(form, value, options = {}) ⇒ ButtonComponent

Returns a new instance of ButtonComponent.



8
9
10
11
12
# File 'app/components/view_component/form/button_component.rb', line 8

def initialize(form, value, options = {})
  @value = value

  super(form, nil, options)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'app/components/view_component/form/button_component.rb', line 6

def value
  @value
end

Instance Method Details

#callObject



14
15
16
# File 'app/components/view_component/form/button_component.rb', line 14

def call
  button_tag(content || value, options)
end