Class: Superform::Rails::Components::Base
- Inherits:
-
Superform::Rails::Component
- Object
- Superform::Rails::Components::Base
- Defined in:
- lib/superform/rails/components/base.rb
Instance Attribute Summary collapse
-
#dom ⇒ Object
readonly
Returns the value of attribute dom.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Instance Method Summary collapse
- #field_attributes ⇒ Object
- #focus(value = true) ⇒ Object
-
#initialize(field, attributes: {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(field, attributes: {}) ⇒ Base
Returns a new instance of Base.
9 10 11 12 |
# File 'lib/superform/rails/components/base.rb', line 9 def initialize(field, attributes: {}) @field = field @attributes = attributes end |
Instance Attribute Details
#dom ⇒ Object (readonly)
Returns the value of attribute dom.
5 6 7 |
# File 'lib/superform/rails/components/base.rb', line 5 def dom @dom end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
5 6 7 |
# File 'lib/superform/rails/components/base.rb', line 5 def field @field end |
Instance Method Details
#field_attributes ⇒ Object
14 15 16 |
# File 'lib/superform/rails/components/base.rb', line 14 def field_attributes {} end |
#focus(value = true) ⇒ Object
18 19 20 21 |
# File 'lib/superform/rails/components/base.rb', line 18 def focus(value = true) @attributes[:autofocus] = value self end |