Class: Economy::Cache
- Inherits:
-
Object
show all
- Defined in:
- lib/economy/cache.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
16
17
18
|
# File 'lib/economy/cache.rb', line 16
def method_missing(name, *args, &block)
redis.public_send name, *args, &block
end
|
Instance Method Details
#clear ⇒ Object
12
13
14
|
# File 'lib/economy/cache.rb', line 12
def clear
del 'exchanges/*'
end
|
#fetch(from, to) ⇒ Object
4
5
6
|
# File 'lib/economy/cache.rb', line 4
def fetch(from, to)
get "exchanges/#{from.iso_code.downcase}/#{to.iso_code.downcase}"
end
|
#update(exchange) ⇒ Object
8
9
10
|
# File 'lib/economy/cache.rb', line 8
def update(exchange)
set "exchanges/#{exchange.from.downcase}/#{exchange.to.downcase}", exchange.rate.to_s
end
|