Class: Royal::Transaction::Operation
- Inherits:
-
Struct
- Object
- Struct
- Royal::Transaction::Operation
- Defined in:
- lib/royal/transaction.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#pointable ⇒ Object
Returns the value of attribute pointable.
-
#reason ⇒ Object
Returns the value of attribute reason.
Instance Method Summary collapse
- #perform ⇒ void
-
#sorting_key ⇒ Array
Used to ensure a deterministic order of operations in a transaction to avoid deadlocks.
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount
5 6 7 |
# File 'lib/royal/transaction.rb', line 5 def amount @amount end |
#owner ⇒ Object
Returns the value of attribute owner
5 6 7 |
# File 'lib/royal/transaction.rb', line 5 def owner @owner end |
#pointable ⇒ Object
Returns the value of attribute pointable
5 6 7 |
# File 'lib/royal/transaction.rb', line 5 def pointable @pointable end |
#reason ⇒ Object
Returns the value of attribute reason
5 6 7 |
# File 'lib/royal/transaction.rb', line 5 def reason @reason end |
Instance Method Details
#perform ⇒ void
This method returns an undefined value.
7 8 9 |
# File 'lib/royal/transaction.rb', line 7 def perform owner.add_points(amount, reason: reason, pointable: pointable) end |
#sorting_key ⇒ Array
Used to ensure a deterministic order of operations in a transaction to avoid deadlocks.
14 15 16 |
# File 'lib/royal/transaction.rb', line 14 def sorting_key [owner.class.polymorphic_name, owner.id, -amount] end |