Class: Agave::Local::Loader
- Inherits:
-
Object
- Object
- Agave::Local::Loader
- Defined in:
- lib/agave/local/loader.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#entities_repo ⇒ Object
readonly
Returns the value of attribute entities_repo.
-
#items_repo ⇒ Object
readonly
Returns the value of attribute items_repo.
-
#preview_mode ⇒ Object
readonly
Returns the value of attribute preview_mode.
Instance Method Summary collapse
-
#initialize(client, preview_mode = false) ⇒ Loader
constructor
A new instance of Loader.
- #load ⇒ Object
Constructor Details
#initialize(client, preview_mode = false) ⇒ Loader
Returns a new instance of Loader.
13 14 15 16 17 18 |
# File 'lib/agave/local/loader.rb', line 13 def initialize(client, preview_mode = false) @client = client @preview_mode = preview_mode @entities_repo = EntitiesRepo.new @items_repo = ItemsRepo.new(@entities_repo) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/agave/local/loader.rb', line 8 def client @client end |
#entities_repo ⇒ Object (readonly)
Returns the value of attribute entities_repo.
9 10 11 |
# File 'lib/agave/local/loader.rb', line 9 def entities_repo @entities_repo end |
#items_repo ⇒ Object (readonly)
Returns the value of attribute items_repo.
10 11 12 |
# File 'lib/agave/local/loader.rb', line 10 def items_repo @items_repo end |
#preview_mode ⇒ Object (readonly)
Returns the value of attribute preview_mode.
11 12 13 |
# File 'lib/agave/local/loader.rb', line 11 def preview_mode @preview_mode end |
Instance Method Details
#load ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/agave/local/loader.rb', line 20 def load threads = [ Thread.new { Thread.current[:output] = site }, Thread.new { Thread.current[:output] = all_items }, Thread.new { Thread.current[:output] = all_uploads } ] results = threads.map do |t| t.join t[:output] end @entities_repo = EntitiesRepo.new(*results) @items_repo = ItemsRepo.new(@entities_repo) end |