Class: ActsAsCalculator::Result
- Inherits:
-
Data
- Object
- Data
- ActsAsCalculator::Result
- Defined in:
- lib/acts_as_calculator/result.rb
Instance Attribute Summary collapse
-
#as_of ⇒ Object
readonly
Returns the value of attribute as_of.
-
#breakdown ⇒ Object
readonly
Returns the value of attribute breakdown.
-
#formula_version ⇒ Object
readonly
Returns the value of attribute formula_version.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expression ⇒ Object
-
#initialize(value:, breakdown: {}, formula_version: nil, as_of: nil) ⇒ Result
constructor
A new instance of Result.
- #inputs ⇒ Object
Constructor Details
#initialize(value:, breakdown: {}, formula_version: nil, as_of: nil) ⇒ Result
Returns a new instance of Result.
5 6 7 |
# File 'lib/acts_as_calculator/result.rb', line 5 def initialize(value:, breakdown: {}, formula_version: nil, as_of: nil) super(value:, breakdown: deep_copy(breakdown), formula_version:, as_of:) end |
Instance Attribute Details
#as_of ⇒ Object (readonly)
Returns the value of attribute as_of
4 5 6 |
# File 'lib/acts_as_calculator/result.rb', line 4 def as_of @as_of end |
#breakdown ⇒ Object (readonly)
Returns the value of attribute breakdown
4 5 6 |
# File 'lib/acts_as_calculator/result.rb', line 4 def breakdown @breakdown end |
#formula_version ⇒ Object (readonly)
Returns the value of attribute formula_version
4 5 6 |
# File 'lib/acts_as_calculator/result.rb', line 4 def formula_version @formula_version end |
#value ⇒ Object (readonly)
Returns the value of attribute value
4 5 6 |
# File 'lib/acts_as_calculator/result.rb', line 4 def value @value end |
Instance Method Details
#expression ⇒ Object
13 14 15 |
# File 'lib/acts_as_calculator/result.rb', line 13 def expression breakdown[:expression] end |
#inputs ⇒ Object
9 10 11 |
# File 'lib/acts_as_calculator/result.rb', line 9 def inputs breakdown.fetch(:inputs, {}) end |