Class: Timeprice::InflationResult

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

Instance Method Summary collapse

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount

Returns:

  • (Object)

    the current value of amount



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

def amount
  @amount
end

#countryObject (readonly)

Returns the value of attribute country

Returns:

  • (Object)

    the current value of country



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

def country
  @country
end

#fromObject (readonly)

Returns the value of attribute from

Returns:

  • (Object)

    the current value of from



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

def from
  @from
end

#from_indexObject (readonly)

Returns the value of attribute from_index

Returns:

  • (Object)

    the current value of from_index



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

def from_index
  @from_index
end

#granularityObject (readonly)

Returns the value of attribute granularity

Returns:

  • (Object)

    the current value of granularity



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

def granularity
  @granularity
end

#original_amountObject (readonly)

Returns the value of attribute original_amount

Returns:

  • (Object)

    the current value of original_amount



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

def original_amount
  @original_amount
end

#toObject (readonly)

Returns the value of attribute to

Returns:

  • (Object)

    the current value of to



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

def to
  @to
end

#to_indexObject (readonly)

Returns the value of attribute to_index

Returns:

  • (Object)

    the current value of to_index



11
12
13
# File 'lib/timeprice/inflation.rb', line 11

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.



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