Class: CouchdbRebuildViewIndices::Indexer
- Inherits:
-
Object
- Object
- CouchdbRebuildViewIndices::Indexer
- Defined in:
- lib/couchdb_rebuild_view_indices.rb
Overview
Class for describing an indexer of CouchDB design documents.
Constant Summary collapse
- @@default_options =
{ host: '127.0.0.1', retries: 10, port: 5984, protocol: 'http', log_level: Logger::INFO }
Instance Attribute Summary collapse
-
#options ⇒ Object
writeonly
Sets the attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ Indexer
constructor
A new instance of Indexer.
- #run! ⇒ Object
Constructor Details
#initialize(options) ⇒ Indexer
Returns a new instance of Indexer.
21 22 23 24 25 26 27 |
# File 'lib/couchdb_rebuild_view_indices.rb', line 21 def initialize() @options = @@default_options.merge!() @logger = Logger.new(STDOUT) @logger.level = @options[:log_level] @logger.debug 'Running with options:' @logger.debug @options end |
Instance Attribute Details
#options=(value) ⇒ Object (writeonly)
Sets the attribute options
11 12 13 |
# File 'lib/couchdb_rebuild_view_indices.rb', line 11 def (value) @options = value end |
Instance Method Details
#run! ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/couchdb_rebuild_view_indices.rb', line 29 def run! docs = get_design_docs(design_docs_uri) docs.each do |doc| next unless doc['doc'].key?('views') iterate_on_views(doc['id'], doc['doc']['views']) end end |