Class: Superform::Rails::Components::BaseComponent

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

Direct Known Subclasses

FieldComponent, LabelComponent

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, attributes: {}) ⇒ BaseComponent

Returns a new instance of BaseComponent.



206
207
208
209
# File 'lib/superform/rails.rb', line 206

def initialize(field, attributes: {})
  @field = field
  @attributes = attributes
end

Instance Attribute Details

#domObject (readonly)

Returns the value of attribute dom.



202
203
204
# File 'lib/superform/rails.rb', line 202

def dom
  @dom
end

#fieldObject (readonly)

Returns the value of attribute field.



202
203
204
# File 'lib/superform/rails.rb', line 202

def field
  @field
end

Instance Method Details

#field_attributesObject



211
212
213
# File 'lib/superform/rails.rb', line 211

def field_attributes
  {}
end

#focus(value = true) ⇒ Object



215
216
217
218
# File 'lib/superform/rails.rb', line 215

def focus(value = true)
  @attributes[:autofocus] = value
  self
end