Class: BatchLoader::Executor
- Inherits:
-
Object
- Object
- BatchLoader::Executor
- Defined in:
- lib/batch_loader/executor.rb
Constant Summary collapse
- NAMESPACE =
:batch_loader
Instance Attribute Summary collapse
-
#items_by_block ⇒ Object
readonly
Returns the value of attribute items_by_block.
-
#loaded_values_by_block ⇒ Object
readonly
Returns the value of attribute loaded_values_by_block.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize ⇒ Executor
Returns a new instance of Executor.
21 22 23 24 |
# File 'lib/batch_loader/executor.rb', line 21 def initialize @items_by_block = Hash.new { |hash, key| hash[key] = Set.new } @loaded_values_by_block = Hash.new { |hash, key| hash[key] = {} } end |
Instance Attribute Details
#items_by_block ⇒ Object (readonly)
Returns the value of attribute items_by_block.
19 20 21 |
# File 'lib/batch_loader/executor.rb', line 19 def items_by_block @items_by_block end |
#loaded_values_by_block ⇒ Object (readonly)
Returns the value of attribute loaded_values_by_block.
19 20 21 |
# File 'lib/batch_loader/executor.rb', line 19 def loaded_values_by_block @loaded_values_by_block end |
Class Method Details
.clear_current ⇒ Object
15 16 17 |
# File 'lib/batch_loader/executor.rb', line 15 def self.clear_current Thread.current[NAMESPACE] = nil end |
.current ⇒ Object
11 12 13 |
# File 'lib/batch_loader/executor.rb', line 11 def self.current Thread.current[NAMESPACE] end |
.ensure_current ⇒ Object
7 8 9 |
# File 'lib/batch_loader/executor.rb', line 7 def self.ensure_current Thread.current[NAMESPACE] ||= new end |