Class: Roulette::Transaction
- Inherits:
-
Object
- Object
- Roulette::Transaction
- Defined in:
- lib/roulette.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#key ⇒ Object
Returns the value of attribute key.
-
#stores ⇒ Object
Returns the value of attribute stores.
Instance Method Summary collapse
- #extract_key ⇒ Object
- #fire(method) ⇒ Object
-
#initialize(stores, *args) ⇒ Transaction
constructor
A new instance of Transaction.
Constructor Details
#initialize(stores, *args) ⇒ Transaction
Returns a new instance of Transaction.
29 30 31 32 33 |
# File 'lib/roulette.rb', line 29 def initialize(stores, *args) self.stores = stores self.args = *args extract_key end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
26 27 28 |
# File 'lib/roulette.rb', line 26 def args @args end |
#key ⇒ Object
Returns the value of attribute key.
26 27 28 |
# File 'lib/roulette.rb', line 26 def key @key end |
#stores ⇒ Object
Returns the value of attribute stores.
26 27 28 |
# File 'lib/roulette.rb', line 26 def stores @stores end |
Instance Method Details
#extract_key ⇒ Object
35 36 37 38 39 40 |
# File 'lib/roulette.rb', line 35 def extract_key # there is a 'bug' with something in the rails library that when loaded will # produce Roulette::Transaction.new([], "key") # => "k" instead of "key" # this is a fix for that, but i don't know what in rails env causes this discrepency self.key = args.is_a?(Array) ? args.first.to_s : args.to_s end |
#fire(method) ⇒ Object
42 43 44 |
# File 'lib/roulette.rb', line 42 def fire(method) select_store.send method.to_sym, *args end |