Class: Mongoid::SearchIndexable::Status Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/search_indexable.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents the status of the indexes returned by a search_indexes call.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(indexes) ⇒ Status

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a new Status object.



20
21
22
# File 'lib/mongoid/search_indexable.rb', line 20

def initialize(indexes)
  @indexes = indexes
end

Instance Attribute Details

#indexesArray<Hash> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the raw index documents.



15
16
17
# File 'lib/mongoid/search_indexable.rb', line 15

def indexes
  @indexes
end

Instance Method Details

#pendingArray<Hash>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the subset of indexes that have status == ‘PENDING’



34
35
36
# File 'lib/mongoid/search_indexable.rb', line 34

def pending
  indexes.select { |i| i['status'] == 'PENDING' }
end

#queryableArray<Hash>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the subset of indexes that are marked ‘queryable’



41
42
43
# File 'lib/mongoid/search_indexable.rb', line 41

def queryable
  indexes.select { |i| i['queryable'] }
end

#readyArray<Hash>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the subset of indexes that have status == ‘READY’



27
28
29
# File 'lib/mongoid/search_indexable.rb', line 27

def ready
  indexes.select { |i| i['status'] == 'READY' }
end

#ready?true | false

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns true if all the given indexes are ‘ready’ and ‘queryable’.



48
49
50
# File 'lib/mongoid/search_indexable.rb', line 48

def ready?
  indexes.all? { |i| i['status'] == 'READY' && i['queryable'] }
end