Class: ExchangeRate::Currency

Inherits:
Object
  • Object
show all
Defined in:
lib/exchange_rate/currency.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attr = {}) ⇒ Currency

Returns a new instance of Currency.



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

def initialize(attr={})
  @name = attr.delete(:name)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/exchange_rate/currency.rb', line 3

def name
  @name
end

Class Method Details

.allObject



9
10
11
12
13
# File 'lib/exchange_rate/currency.rb', line 9

def self.all
  @all_currencies ||= data_source.currency_names.map do |name|
    new(:name => name)
  end
end