Class: Pose::Jobs::ReindexAll
- Inherits:
-
Object
- Object
- Pose::Jobs::ReindexAll
- Defined in:
- lib/pose/jobs/reindex_all.rb
Overview
Recreates the Pose search index for the given class from scratch.
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
-
#initialize(clazz) ⇒ ReindexAll
constructor
A new instance of ReindexAll.
- #perform ⇒ Object
Constructor Details
#initialize(clazz) ⇒ ReindexAll
Returns a new instance of ReindexAll.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pose/jobs/reindex_all.rb', line 11 def initialize(clazz) @klass = case clazz when String clazz.constantize when Class clazz else raise ArgumentError, "Class or String expected, #{clazz.class} given" end end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
8 9 10 |
# File 'lib/pose/jobs/reindex_all.rb', line 8 def klass @klass end |
Instance Method Details
#perform ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pose/jobs/reindex_all.rb', line 22 def perform = ProgressBar.create title: " reindexing", total: klass.count klass.find_each do |instance| instance.update_pose_words .increment end .finish end |