Class: Uchi::Field::Base::Component
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Uchi::Field::Base::Component
- Includes:
- RoutesHelper
- 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.
Methods included from RoutesHelper
Constructor Details
#initialize(field:, record:, repository:) ⇒ Component
Returns a new instance of Component.
11 12 13 14 15 16 17 |
# File 'app/components/uchi/field/base.rb', line 11 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.
9 10 11 |
# File 'app/components/uchi/field/base.rb', line 9 def field @field end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
9 10 11 |
# File 'app/components/uchi/field/base.rb', line 9 def record @record end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
9 10 11 |
# File 'app/components/uchi/field/base.rb', line 9 def repository @repository end |
Instance Method Details
#value ⇒ Object
Returns the raw value of the field as returned by the field's value method.
21 22 23 24 25 |
# File 'app/components/uchi/field/base.rb', line 21 def value return @value if instance_variable_defined?(:@value) @value = field.value(record) end |