Class: Danconia::Stores::InMemory

Inherits:
Object
  • Object
show all
Defined in:
lib/danconia/stores/in_memory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rates: {}) ⇒ InMemory

Returns a new instance of InMemory.



6
7
8
# File 'lib/danconia/stores/in_memory.rb', line 6

def initialize rates: {}
  save_rates rates
end

Instance Attribute Details

#ratesObject (readonly)

Returns the value of attribute rates.



4
5
6
# File 'lib/danconia/stores/in_memory.rb', line 4

def rates
  @rates
end

Instance Method Details

#direct_rate(from, to) ⇒ Object



15
16
17
# File 'lib/danconia/stores/in_memory.rb', line 15

def direct_rate from, to
  @rates[[from, to].join]
end

#save_rates(rates) ⇒ Object



11
12
13
# File 'lib/danconia/stores/in_memory.rb', line 11

def save_rates rates
  @rates = rates
end