Class: Esse::CLI::Index::UpdateLazyAttributes
- Inherits:
-
BaseOperation
- Object
- BaseOperation
- Esse::CLI::Index::UpdateLazyAttributes
- Defined in:
- lib/esse/cli/index/update_lazy_attributes.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(indices:, attributes: nil, **options) ⇒ UpdateLazyAttributes
constructor
A new instance of UpdateLazyAttributes.
- #run ⇒ Object
Methods included from Output
colorize, formatted_runtime, print_backtrace, print_error, print_message, runtime_padding
Constructor Details
#initialize(indices:, attributes: nil, **options) ⇒ UpdateLazyAttributes
Returns a new instance of UpdateLazyAttributes.
10 11 12 13 |
# File 'lib/esse/cli/index/update_lazy_attributes.rb', line 10 def initialize(indices:, attributes: nil, **) super(indices: indices, **) @attributes = Array(attributes) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
8 9 10 |
# File 'lib/esse/cli/index/update_lazy_attributes.rb', line 8 def attributes @attributes end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/esse/cli/index/update_lazy_attributes.rb', line 15 def run indices.each do |index| repos = if (repo = @options[:repo]) [index.repo(repo)] else index.repo_hash.values end repos.each do |repo| attrs = repo_attributes(repo) next unless attrs.any? repo.send(:each_batch_ids, **) do |ids| attrs.each do |attribute| repo.update_documents_attribute(attribute, ids, ) end end end end end |