Class: Hekenga::DocumentTask
- Inherits:
-
Object
- Object
- Hekenga::DocumentTask
- Defined in:
- lib/hekenga/document_task.rb
Instance Attribute Summary collapse
-
#after_callbacks ⇒ Object
readonly
Returns the value of attribute after_callbacks.
-
#always_write ⇒ Object
Returns the value of attribute always_write.
-
#batch_size ⇒ Object
Returns the value of attribute batch_size.
-
#cursor_timeout ⇒ Object
Returns the value of attribute cursor_timeout.
-
#description ⇒ Object
Returns the value of attribute description.
-
#downs ⇒ Object
readonly
Returns the value of attribute downs.
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#invalid_strategy ⇒ Object
Returns the value of attribute invalid_strategy.
-
#parallel ⇒ Object
Returns the value of attribute parallel.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#setups ⇒ Object
readonly
Returns the value of attribute setups.
-
#skip_prepare ⇒ Object
Returns the value of attribute skip_prepare.
-
#timeless ⇒ Object
Returns the value of attribute timeless.
-
#ups ⇒ Object
readonly
Returns the value of attribute ups.
-
#use_transaction ⇒ Object
Returns the value of attribute use_transaction.
-
#write_strategy ⇒ Object
Returns the value of attribute write_strategy.
Instance Method Summary collapse
- #down!(context, document) ⇒ Object
-
#initialize ⇒ DocumentTask
constructor
A new instance of DocumentTask.
- #reversible? ⇒ Boolean
- #up!(context, document) ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ DocumentTask
Returns a new instance of DocumentTask.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hekenga/document_task.rb', line 10 def initialize @ups = [] @downs = [] @setups = [] @filters = [] @after_callbacks = [] @invalid_strategy = :continue @write_strategy = :update @skip_prepare = false @batch_size = nil @always_write = false @use_transaction = false @cursor_timeout = Hekenga::BaseIterator::DEFAULT_TIMEOUT end |
Instance Attribute Details
#after_callbacks ⇒ Object (readonly)
Returns the value of attribute after_callbacks.
5 6 7 |
# File 'lib/hekenga/document_task.rb', line 5 def after_callbacks @after_callbacks end |
#always_write ⇒ Object
Returns the value of attribute always_write.
8 9 10 |
# File 'lib/hekenga/document_task.rb', line 8 def always_write @always_write end |
#batch_size ⇒ Object
Returns the value of attribute batch_size.
6 7 8 |
# File 'lib/hekenga/document_task.rb', line 6 def batch_size @batch_size end |
#cursor_timeout ⇒ Object
Returns the value of attribute cursor_timeout.
6 7 8 |
# File 'lib/hekenga/document_task.rb', line 6 def cursor_timeout @cursor_timeout end |
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/hekenga/document_task.rb', line 7 def description @description end |
#downs ⇒ Object (readonly)
Returns the value of attribute downs.
5 6 7 |
# File 'lib/hekenga/document_task.rb', line 5 def downs @downs end |
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
5 6 7 |
# File 'lib/hekenga/document_task.rb', line 5 def filters @filters end |
#invalid_strategy ⇒ Object
Returns the value of attribute invalid_strategy.
7 8 9 |
# File 'lib/hekenga/document_task.rb', line 7 def invalid_strategy @invalid_strategy end |
#parallel ⇒ Object
Returns the value of attribute parallel.
6 7 8 |
# File 'lib/hekenga/document_task.rb', line 6 def parallel @parallel end |
#scope ⇒ Object
Returns the value of attribute scope.
6 7 8 |
# File 'lib/hekenga/document_task.rb', line 6 def scope @scope end |
#setups ⇒ Object (readonly)
Returns the value of attribute setups.
5 6 7 |
# File 'lib/hekenga/document_task.rb', line 5 def setups @setups end |
#skip_prepare ⇒ Object
Returns the value of attribute skip_prepare.
7 8 9 |
# File 'lib/hekenga/document_task.rb', line 7 def skip_prepare @skip_prepare end |
#timeless ⇒ Object
Returns the value of attribute timeless.
6 7 8 |
# File 'lib/hekenga/document_task.rb', line 6 def timeless @timeless end |
#ups ⇒ Object (readonly)
Returns the value of attribute ups.
5 6 7 |
# File 'lib/hekenga/document_task.rb', line 5 def ups @ups end |
#use_transaction ⇒ Object
Returns the value of attribute use_transaction.
8 9 10 |
# File 'lib/hekenga/document_task.rb', line 8 def use_transaction @use_transaction end |
#write_strategy ⇒ Object
Returns the value of attribute write_strategy.
7 8 9 |
# File 'lib/hekenga/document_task.rb', line 7 def write_strategy @write_strategy end |
Instance Method Details
#down!(context, document) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/hekenga/document_task.rb', line 35 def down!(context, document) raise Hekenga::Irreversible.new(self) unless reversible? @downs.each do |block| context.instance_eval(document, &block) end end |
#reversible? ⇒ Boolean
42 43 44 |
# File 'lib/hekenga/document_task.rb', line 42 def reversible? downs.any? end |
#up!(context, document) ⇒ Object
29 30 31 32 33 |
# File 'lib/hekenga/document_task.rb', line 29 def up!(context, document) @ups.each do |block| context.instance_exec(document, &block) end end |