Class: Superform::Rails::Components::Base

Inherits:
Superform::Rails::Component
  • Object
show all
Defined in:
lib/superform/rails/components/base.rb

Direct Known Subclasses

Field, Label

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#domObject (readonly)

Returns the value of attribute dom.



5
6
7
# File 'lib/superform/rails/components/base.rb', line 5

def dom
  @dom
end

#fieldObject (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_attributesObject



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