Class: Spinoza::DeleteOperation

Inherits:
Operation show all
Defined in:
lib/spinoza/system/operation.rb

Instance Attribute Summary collapse

Attributes inherited from Operation

#table

Instance Method Summary collapse

Methods inherited from Operation

#check

Constructor Details

#initialize(txn = nil, table: nil, key: nil) ⇒ DeleteOperation

Returns a new instance of DeleteOperation.



66
67
68
69
# File 'lib/spinoza/system/operation.rb', line 66

def initialize txn = nil, table: nil, key: nil
  @txn = txn
  @table, @key = table, key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



65
66
67
# File 'lib/spinoza/system/operation.rb', line 65

def key
  @key
end

Instance Method Details

#execute(ds) ⇒ Object



71
72
73
# File 'lib/spinoza/system/operation.rb', line 71

def execute ds
  ds.where(key).delete
end

#inspectObject



75
76
77
# File 'lib/spinoza/system/operation.rb', line 75

def inspect
  "<delete #{table} #{key}>"
end