Class: Desi::IndexManager::Index
- Inherits:
-
Object
- Object
- Desi::IndexManager::Index
- Defined in:
- lib/desi/index_manager.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number_of_documents ⇒ Object
readonly
Returns the value of attribute number_of_documents.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #aliased? ⇒ Boolean
- #closed? ⇒ Boolean
-
#initialize(name, state_data, status_data) ⇒ Index
constructor
A new instance of Index.
- #inspect ⇒ Object
- #open? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name, state_data, status_data) ⇒ Index
Returns a new instance of Index.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/desi/index_manager.rb', line 15 def initialize(name, state_data, status_data) @name = name @number_of_documents = status_data["docs"]["num_docs"] if status_data && status_data["docs"] @aliases = [] if state_data @aliases = state_data['aliases'] @state = state_data['state'] end end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
13 14 15 |
# File 'lib/desi/index_manager.rb', line 13 def aliases @aliases end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/desi/index_manager.rb', line 13 def name @name end |
#number_of_documents ⇒ Object (readonly)
Returns the value of attribute number_of_documents.
13 14 15 |
# File 'lib/desi/index_manager.rb', line 13 def number_of_documents @number_of_documents end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
13 14 15 |
# File 'lib/desi/index_manager.rb', line 13 def state @state end |
Instance Method Details
#<=>(other) ⇒ Object
38 39 40 |
# File 'lib/desi/index_manager.rb', line 38 def <=>(other) name <=> other.name end |
#aliased? ⇒ Boolean
34 35 36 |
# File 'lib/desi/index_manager.rb', line 34 def aliased? !(aliases.nil? || aliases.empty?) end |
#closed? ⇒ Boolean
46 47 48 |
# File 'lib/desi/index_manager.rb', line 46 def closed? state == "close" end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/desi/index_manager.rb', line 30 def inspect "#{name} (#{number_of_docs_label})#{aliases_label}" end |
#open? ⇒ Boolean
42 43 44 |
# File 'lib/desi/index_manager.rb', line 42 def open? state == "open" end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/desi/index_manager.rb', line 26 def to_s name end |