Class: Uchi::Field::Base::Component
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Uchi::Field::Base::Component
- Defined in:
- app/components/uchi/field/base.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#initialize(field:, record:, repository:) ⇒ Component
constructor
A new instance of Component.
-
#value ⇒ Object
Returns the raw value of the field as returned by the field's value method.
Constructor Details
#initialize(field:, record:, repository:) ⇒ Component
Returns a new instance of Component.
9 10 11 12 13 14 15 |
# File 'app/components/uchi/field/base.rb', line 9 def initialize(field:, record:, repository:) super() @field = field @record = record @repository = repository end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
7 8 9 |
# File 'app/components/uchi/field/base.rb', line 7 def field @field end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
7 8 9 |
# File 'app/components/uchi/field/base.rb', line 7 def record @record end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
7 8 9 |
# File 'app/components/uchi/field/base.rb', line 7 def repository @repository end |
Instance Method Details
#value ⇒ Object
Returns the raw value of the field as returned by the field's value method.
19 20 21 22 23 |
# File 'app/components/uchi/field/base.rb', line 19 def value return @value if instance_variable_defined?(:@value) @value = field.value(record) end |