Class: Spinoza::UpdateOperation
- Defined in:
- lib/spinoza/system/operation.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
Attributes inherited from Operation
Instance Method Summary collapse
- #check(lm) ⇒ Object
- #execute(ds) ⇒ Object
-
#initialize(txn = nil, table: nil, row: nil, key: nil) ⇒ UpdateOperation
constructor
A new instance of UpdateOperation.
- #inspect ⇒ Object
Constructor Details
#initialize(txn = nil, table: nil, row: nil, key: nil) ⇒ UpdateOperation
Returns a new instance of UpdateOperation.
46 47 48 49 |
# File 'lib/spinoza/system/operation.rb', line 46 def initialize txn = nil, table: nil, row: nil, key: nil @txn = txn @table, @key, @row = table, key, row end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
45 46 47 |
# File 'lib/spinoza/system/operation.rb', line 45 def key @key end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
45 46 47 |
# File 'lib/spinoza/system/operation.rb', line 45 def row @row end |
Instance Method Details
#check(lm) ⇒ Object
55 56 57 |
# File 'lib/spinoza/system/operation.rb', line 55 def check lm lm.has_write_lock? table, key, txn end |
#execute(ds) ⇒ Object
51 52 53 |
# File 'lib/spinoza/system/operation.rb', line 51 def execute ds ds.where(key).update(row) end |
#inspect ⇒ Object
59 60 61 |
# File 'lib/spinoza/system/operation.rb', line 59 def inspect "<update #{table} #{key}: #{row}>" end |