Class: Spinoza::ReadOperation
- Defined in:
- lib/spinoza/system/operation.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Attributes inherited from Operation
Instance Method Summary collapse
- #execute(ds) ⇒ Object
-
#initialize(txn = nil, table: nil, key: nil) ⇒ ReadOperation
constructor
A new instance of ReadOperation.
- #inspect ⇒ Object
Methods inherited from Operation
Constructor Details
#initialize(txn = nil, table: nil, key: nil) ⇒ ReadOperation
Returns a new instance of ReadOperation.
82 83 84 85 |
# File 'lib/spinoza/system/operation.rb', line 82 def initialize txn = nil, table: nil, key: nil @txn = txn @table, @key = table, key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
81 82 83 |
# File 'lib/spinoza/system/operation.rb', line 81 def key @key end |
Instance Method Details
#execute(ds) ⇒ Object
87 88 89 |
# File 'lib/spinoza/system/operation.rb', line 87 def execute ds ReadResult.new(op: self, val: ds.where(key).first) end |
#inspect ⇒ Object
91 92 93 |
# File 'lib/spinoza/system/operation.rb', line 91 def inspect "<read #{table} #{key}>" end |