Class: Danconia::Stores::InMemory
- Inherits:
-
Object
- Object
- Danconia::Stores::InMemory
- Defined in:
- lib/danconia/stores/in_memory.rb
Instance Attribute Summary collapse
-
#rates ⇒ Object
readonly
Returns the value of attribute rates.
Instance Method Summary collapse
- #direct_rate(from, to) ⇒ Object
-
#initialize(rates: {}) ⇒ InMemory
constructor
A new instance of InMemory.
- #save_rates(rates) ⇒ Object
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
#rates ⇒ Object (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 |