Class: Timeprice::InflationResult
- Inherits:
-
Data
- Object
- Data
- Timeprice::InflationResult
- Defined in:
- lib/timeprice/inflation.rb
Overview
Value object returned by Inflation.adjust. See Granularity for the set of possible ‘granularity` values and the worst-precision-wins merge rule.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#from_index ⇒ Object
readonly
Returns the value of attribute from_index.
-
#granularity ⇒ Object
readonly
Returns the value of attribute granularity.
-
#original_amount ⇒ Object
readonly
Returns the value of attribute original_amount.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#to_index ⇒ Object
readonly
Returns the value of attribute to_index.
Instance Method Summary collapse
-
#country_currency_label ⇒ Object
The country’s primary currency (e.g. “USD” for “US”).
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def amount @amount end |
#country ⇒ Object (readonly)
Returns the value of attribute country
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def country @country end |
#from ⇒ Object (readonly)
Returns the value of attribute from
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def from @from end |
#from_index ⇒ Object (readonly)
Returns the value of attribute from_index
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def from_index @from_index end |
#granularity ⇒ Object (readonly)
Returns the value of attribute granularity
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def granularity @granularity end |
#original_amount ⇒ Object (readonly)
Returns the value of attribute original_amount
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def original_amount @original_amount end |
#to ⇒ Object (readonly)
Returns the value of attribute to
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def to @to end |
#to_index ⇒ Object (readonly)
Returns the value of attribute to_index
11 12 13 |
# File 'lib/timeprice/inflation.rb', line 11 def to_index @to_index end |
Instance Method Details
#country_currency_label ⇒ Object
The country’s primary currency (e.g. “USD” for “US”). Falls back to the uppercased country code if the country isn’t in the supported map —callers can still render some unit rather than crashing.
18 19 20 21 |
# File 'lib/timeprice/inflation.rb', line 18 def country_currency_label require_relative "supported" Supported.currency_for_country(country) || country.to_s.upcase end |