Class: HakumiComponents::FormBuilder::FieldContext
- Inherits:
-
Object
- Object
- HakumiComponents::FormBuilder::FieldContext
- Extended by:
- T::Sig
- Defined in:
- app/form_builders/hakumi_components/form_builder/field_context.rb
Overview
typed: strict frozen_string_literal: true
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name:, id:, value:, errors:) ⇒ FieldContext
constructor
A new instance of FieldContext.
- #to_options ⇒ Object
Constructor Details
#initialize(name:, id:, value:, errors:) ⇒ FieldContext
Returns a new instance of FieldContext.
27 28 29 30 31 32 |
# File 'app/form_builders/hakumi_components/form_builder/field_context.rb', line 27 def initialize(name:, id:, value:, errors:) @name = T.let(name, String) @id = T.let(id, String) @value = T.let(value, HakumiComponents::Types::FormFieldValue) @errors = T.let(errors, T::Array[String]) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
17 18 19 |
# File 'app/form_builders/hakumi_components/form_builder/field_context.rb', line 17 def errors @errors end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'app/form_builders/hakumi_components/form_builder/field_context.rb', line 11 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'app/form_builders/hakumi_components/form_builder/field_context.rb', line 8 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
14 15 16 |
# File 'app/form_builders/hakumi_components/form_builder/field_context.rb', line 14 def value @value end |
Instance Method Details
#to_options ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'app/form_builders/hakumi_components/form_builder/field_context.rb', line 35 def { name: @name, id: @id, value: @value, errors: @errors } end |