Class: Sprig::Reap::Value
- Inherits:
-
Object
- Object
- Sprig::Reap::Value
- Defined in:
- lib/sprig/reap/value.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#raw_value ⇒ Object
readonly
Returns the value of attribute raw_value.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#sprig_record ⇒ Object
readonly
Returns the value of attribute sprig_record.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #for_sprig_file ⇒ Object
-
#initialize(sprig_record, attribute) ⇒ Value
constructor
A new instance of Value.
Constructor Details
#initialize(sprig_record, attribute) ⇒ Value
Returns a new instance of Value.
11 12 13 14 15 16 17 |
# File 'lib/sprig/reap/value.rb', line 11 def initialize(sprig_record, attribute) @sprig_record = sprig_record @record = sprig_record.record @attribute = attribute @value = record.send(attribute) @raw_value = record.read_attribute(attribute) end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
3 4 5 |
# File 'lib/sprig/reap/value.rb', line 3 def attribute @attribute end |
#raw_value ⇒ Object (readonly)
Returns the value of attribute raw_value.
3 4 5 |
# File 'lib/sprig/reap/value.rb', line 3 def raw_value @raw_value end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
3 4 5 |
# File 'lib/sprig/reap/value.rb', line 3 def record @record end |
#sprig_record ⇒ Object (readonly)
Returns the value of attribute sprig_record.
3 4 5 |
# File 'lib/sprig/reap/value.rb', line 3 def sprig_record @sprig_record end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/sprig/reap/value.rb', line 3 def value @value end |
Class Method Details
.for(sprig_record, attribute) ⇒ Object
7 8 9 |
# File 'lib/sprig/reap/value.rb', line 7 def self.for(sprig_record, attribute) new(sprig_record, attribute).for_sprig_file end |
Instance Method Details
#for_sprig_file ⇒ Object
19 20 21 |
# File 'lib/sprig/reap/value.rb', line 19 def for_sprig_file @for_sprig_file ||= dependency? ? sprig_dependency_reference : read_attribute end |