Class: VlatkoDawanda::Currency

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/vlatko_dawanda/currency.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Currency

Returns a new instance of Currency.



7
8
9
10
# File 'lib/vlatko_dawanda/currency.rb', line 7

def initialize(options = {})
  @iso_code = options[:iso_code]
  @rate = validate_rate(options[:rate])
end

Instance Attribute Details

#iso_codeObject (readonly)

Returns the value of attribute iso_code.



5
6
7
# File 'lib/vlatko_dawanda/currency.rb', line 5

def iso_code
  @iso_code
end

#rateObject (readonly)

Returns the value of attribute rate.



5
6
7
# File 'lib/vlatko_dawanda/currency.rb', line 5

def rate
  @rate
end

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
# File 'lib/vlatko_dawanda/currency.rb', line 12

def <=>(other)
  rate <=> other.rate
end