Class: Amount
Instance Attribute Summary collapse
-
#by_type ⇒ Object
readonly
Returns the value of attribute by_type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #divide ⇒ Object
-
#initialize(value, by_type) ⇒ Amount
constructor
A new instance of Amount.
- #inspect ⇒ Object
- #negative ⇒ Object
Constructor Details
#initialize(value, by_type) ⇒ Amount
Returns a new instance of Amount.
3 4 5 6 |
# File 'lib/guerrilla_patch/aggregate_by_type/amount.rb', line 3 def initialize(value, by_type) @value = value @by_type = by_type end |
Instance Attribute Details
#by_type ⇒ Object (readonly)
Returns the value of attribute by_type.
2 3 4 |
# File 'lib/guerrilla_patch/aggregate_by_type/amount.rb', line 2 def by_type @by_type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
2 3 4 |
# File 'lib/guerrilla_patch/aggregate_by_type/amount.rb', line 2 def value @value end |
Instance Method Details
#==(other) ⇒ Object
8 9 10 |
# File 'lib/guerrilla_patch/aggregate_by_type/amount.rb', line 8 def ==(other) self.value == other.value && self.by_type == other.by_type end |
#divide ⇒ Object
26 27 28 |
# File 'lib/guerrilla_patch/aggregate_by_type/amount.rb', line 26 def divide value.divide by_type end |
#inspect ⇒ Object
12 13 14 15 16 17 |
# File 'lib/guerrilla_patch/aggregate_by_type/amount.rb', line 12 def inspect consists_of do |result| result.add value_display result.when(by_type_display != '') { ", #{by_type_display}"} end end |