Module: Picky::Helpers::Indexing
- Includes:
- Measuring
- Included in:
- Categories, Category, Index, Indexes, Indexes
- Defined in:
- lib/picky/helpers/indexing.rb
Instance Method Summary collapse
-
#index(scheduler = Scheduler.new) ⇒ Object
Indexing works the same way, always: * Prepare the scheduler.
-
#timed_indexing(scheduler, &block) ⇒ Object
Runs the block and logs a few infos regarding the time it took.
Methods included from Measuring
Instance Method Details
#index(scheduler = Scheduler.new) ⇒ Object
Indexing works the same way, always:
* Prepare the scheduler.
* Cache the scheduler.
21 22 23 24 25 26 27 28 29 |
# File 'lib/picky/helpers/indexing.rb', line 21 def index scheduler = Scheduler.new timed_indexing scheduler do prepare scheduler scheduler.finish cache scheduler scheduler.finish end end |
#timed_indexing(scheduler, &block) ⇒ Object
Runs the block and logs a few infos regarding the time it took.
12 13 14 15 |
# File 'lib/picky/helpers/indexing.rb', line 12 def timed_indexing scheduler, &block Picky.logger.info "Picky is indexing using #{scheduler.fork? ? 'multiple processes' : 'a single process'}: " Picky.logger.info " Done in #{timed(&block).round}s.\n" end |