Class: Timeprice::InflationResult

Inherits:
Data
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount

Returns:

  • (Object)

    the current value of amount



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def amount
  @amount
end

#countryObject (readonly)

Returns the value of attribute country

Returns:

  • (Object)

    the current value of country



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def country
  @country
end

#fromObject (readonly)

Returns the value of attribute from

Returns:

  • (Object)

    the current value of from



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def from
  @from
end

#from_indexObject (readonly)

Returns the value of attribute from_index

Returns:

  • (Object)

    the current value of from_index



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def from_index
  @from_index
end

#granularityObject (readonly)

Returns the value of attribute granularity

Returns:

  • (Object)

    the current value of granularity



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def granularity
  @granularity
end

#original_amountObject (readonly)

Returns the value of attribute original_amount

Returns:

  • (Object)

    the current value of original_amount



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def original_amount
  @original_amount
end

#toObject (readonly)

Returns the value of attribute to

Returns:

  • (Object)

    the current value of to



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def to
  @to
end

#to_indexObject (readonly)

Returns the value of attribute to_index

Returns:

  • (Object)

    the current value of to_index



15
16
17
# File 'lib/timeprice/inflation.rb', line 15

def to_index
  @to_index
end

Instance Method Details

#country_currency_labelObject

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