Class: Timeprice::InflationResult
- Inherits:
-
Data
- Object
- Data
- Timeprice::InflationResult
- Defined in:
- lib/timeprice/inflation.rb
Overview
Value object returned by Inflation.adjust.
granularity is one of:
:monthly — both ends resolved on monthly data
:annual — at least one end resolved on annual data
:annual_from_monthly_avg — at least one end was an annual request resolved
by averaging 12 months of monthly data
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
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 def amount @amount end |
#country ⇒ Object (readonly)
Returns the value of attribute country
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 def country @country end |
#from ⇒ Object (readonly)
Returns the value of attribute from
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 def from @from end |
#from_index ⇒ Object (readonly)
Returns the value of attribute from_index
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 def from_index @from_index end |
#granularity ⇒ Object (readonly)
Returns the value of attribute granularity
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 def granularity @granularity end |
#original_amount ⇒ Object (readonly)
Returns the value of attribute original_amount
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 def original_amount @original_amount end |
#to ⇒ Object (readonly)
Returns the value of attribute to
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 def to @to end |
#to_index ⇒ Object (readonly)
Returns the value of attribute to_index
15 16 17 |
# File 'lib/timeprice/inflation.rb', line 15 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.
22 23 24 25 |
# File 'lib/timeprice/inflation.rb', line 22 def country_currency_label require_relative "supported" Supported.currency_for_country(country) || country.to_s.upcase end |