Class: Forex::CurrencyCode

Inherits:
Struct
  • Object
show all
Defined in:
lib/forex/tabular_rates.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stringObject

Returns the value of attribute string

Returns:

  • (Object)

    the current value of string



82
83
84
# File 'lib/forex/tabular_rates.rb', line 82

def string
  @string
end

#translationsObject

Returns the value of attribute translations

Returns:

  • (Object)

    the current value of translations



82
83
84
# File 'lib/forex/tabular_rates.rb', line 82

def translations
  @translations
end

Instance Method Details

#invalid?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/forex/tabular_rates.rb', line 89

def invalid?
  !valid?
end

#to_sObject



93
94
95
# File 'lib/forex/tabular_rates.rb', line 93

def to_s
  translated
end

#valid?Boolean

TODO validate the currency codes via www.xe.com/iso4217.php

Returns:

  • (Boolean)


85
86
87
# File 'lib/forex/tabular_rates.rb', line 85

def valid?
  !translated.blank? && translated.length == 3
end