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



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

def string
  @string
end

#translationsObject

Returns the value of attribute translations

Returns:

  • (Object)

    the current value of translations



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

def translations
  @translations
end

Instance Method Details

#invalid?Boolean

Returns:

  • (Boolean)


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

def invalid?
  !valid?
end

#to_sObject



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

def to_s
  translated
end

#valid?Boolean

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

Returns:

  • (Boolean)


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

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