Class: Clowne::Adapters::Sequel::Operation
- Inherits:
-
Utils::Operation
- Object
- Utils::Operation
- Clowne::Adapters::Sequel::Operation
- Includes:
- Ext::RecordKey
- Defined in:
- lib/clowne/adapters/sequel/operation.rb
Constant Summary
Constants inherited from Utils::Operation
Utils::Operation::DEFAULT_MAPPER
Instance Attribute Summary
Attributes inherited from Utils::Operation
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(mapper) ⇒ Operation
constructor
A new instance of Operation.
- #record_wrapper(record) ⇒ Object
- #to_record ⇒ Object
Methods included from Ext::RecordKey
Methods inherited from Utils::Operation
#add_after_clone, #add_after_persist, #add_mapping, clear!, current, #persist, #persist!, #run_after_clone, #run_after_persist, #save, #save!, wrap
Constructor Details
#initialize(mapper) ⇒ Operation
Returns a new instance of Operation.
11 12 13 14 |
# File 'lib/clowne/adapters/sequel/operation.rb', line 11 def initialize(mapper) super @records = {} end |
Instance Method Details
#hash ⇒ Object
20 21 22 |
# File 'lib/clowne/adapters/sequel/operation.rb', line 20 def hash @records[key(@clone)] end |
#record_wrapper(record) ⇒ Object
16 17 18 |
# File 'lib/clowne/adapters/sequel/operation.rb', line 16 def record_wrapper(record) @records[key(record)] ||= RecordWrapper.new(record) end |
#to_record ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/clowne/adapters/sequel/operation.rb', line 24 def to_record return @_record if defined?(@_record) @_record = @records[key(@clone)].to_model.tap do run_after_clone end end |