class Mongoid::SearchIndexable::Status
Represents the status of the indexes returned by a search_indexes call.
@api private
Attributes
indexes[R]
@return [ Array<Hash> ] the raw index documents
Public Class Methods
new(indexes)
click to toggle source
Create a new Status
object.
@param [ Array<Hash> ] indexes the raw index documents
# File lib/mongoid/search_indexable.rb, line 20 def initialize(indexes) @indexes = indexes end
Public Instance Methods
pending()
click to toggle source
Returns the subset of indexes that have status == ‘PENDING’
@return [ Array<Hash> ] index documents for “pending” indices
# File lib/mongoid/search_indexable.rb, line 34 def pending indexes.select { |i| i['status'] == 'PENDING' } end
queryable()
click to toggle source
Returns the subset of indexes that are marked ‘queryable’
@return [ Array<Hash> ] index documents for ‘queryable’ indices
# File lib/mongoid/search_indexable.rb, line 41 def queryable indexes.select { |i| i['queryable'] } end
ready()
click to toggle source
Returns the subset of indexes that have status == ‘READY’
@return [ Array<Hash> ] index documents for “ready” indices
# File lib/mongoid/search_indexable.rb, line 27 def ready indexes.select { |i| i['status'] == 'READY' } end
ready?()
click to toggle source
Returns true if all the given indexes are ‘ready’ and ‘queryable’.
@return [ true | false ] ready status of all indexes
# File lib/mongoid/search_indexable.rb, line 48 def ready? indexes.all? { |i| i['status'] == 'READY' && i['queryable'] } end