Class: Proscenium::UI::Form::Fields::Base
- Defined in:
- lib/proscenium/ui/form/fields/base.rb
Overview
Abstract class to provide basic rendering of an <input>. All field classes inherit this.
Direct Known Subclasses
Checkbox, Combobox, Hidden, Input, RadioGroup, RadioInput, RichTextarea, Select, Tel, Textarea
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#model ⇒ Object
(also: #parent_model)
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(attribute, model, form, type: nil, error: nil, **attributes) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(attribute, model, form, type: nil, error: nil, **attributes) ⇒ Base
Returns a new instance of Base.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/proscenium/ui/form/fields/base.rb', line 27 def initialize(attribute, model, form, type: nil, error: nil, **attributes) if attribute.count > 2 raise ArgumentError, 'attribute cannot be nested more than 2 levels deep' end @attribute = attribute @model = model @form = form @field_type = type @error = error @attributes = attributes end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
11 12 13 |
# File 'lib/proscenium/ui/form/fields/base.rb', line 11 def attribute @attribute end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/proscenium/ui/form/fields/base.rb', line 11 def attributes @attributes end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
11 12 13 |
# File 'lib/proscenium/ui/form/fields/base.rb', line 11 def form @form end |
#model ⇒ Object (readonly) Also known as: parent_model
Returns the value of attribute model.
11 12 13 |
# File 'lib/proscenium/ui/form/fields/base.rb', line 11 def model @model end |