Class: Mongoid::SearchIndexable::Status Private
- Inherits:
-
Object
- Object
- Mongoid::SearchIndexable::Status
- 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
-
#indexes ⇒ Array<Hash>
readonly
private
The raw index documents.
Instance Method Summary collapse
-
#initialize(indexes) ⇒ Status
constructor
private
Create a new Status object.
-
#pending ⇒ Array<Hash>
private
Returns the subset of indexes that have status == ‘PENDING’.
-
#queryable ⇒ Array<Hash>
private
Returns the subset of indexes that are marked ‘queryable’.
-
#ready ⇒ Array<Hash>
private
Returns the subset of indexes that have status == ‘READY’.
-
#ready? ⇒ true | false
private
Returns true if all the given indexes are ‘ready’ and ‘queryable’.
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
#indexes ⇒ Array<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
#pending ⇒ Array<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 |
#queryable ⇒ Array<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 |
#ready ⇒ Array<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 |