Class: Economy::Currencies

Inherits:
Object
  • Object
show all
Defined in:
lib/economy/currencies.rb

Instance Method Summary collapse

Instance Method Details

#add(*args) ⇒ Object



16
17
18
19
# File 'lib/economy/currencies.rb', line 16

def add(*args)
  currency = Currency.new(*args)
  registry[currency.iso_code] = currency
end

#exist?(id) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/economy/currencies.rb', line 4

def exist?(id)
  registry.has_key? id
end

#find(id) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/economy/currencies.rb', line 8

def find(id)
  if exist?(id)
    registry[id]
  else
    raise "Currency #{id} not found"
  end
end