Module: RSolrExt::Response::Base

Included in:
Luke, Select, Update
Defined in:
lib/rsolr_ext/response/base.rb

Overview

my_solr_hash.extend RSolrExt::Response::Base my_solr_hash.header my_solr_hash.ok?

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(hash) ⇒ Object

converts to mash, then extends



29
30
31
32
33
# File 'lib/rsolr_ext/response/base.rb', line 29

def self.create(hash)
  mash = hash.is_a?(Mash) ? hash : hash.to_mash
  mash.extend self
  mash
end

Instance Method Details

#headerObject



8
9
10
# File 'lib/rsolr_ext/response/base.rb', line 8

def header
  self[:responseHeader]
end

#ok?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rsolr_ext/response/base.rb', line 24

def ok?
  self.status == 0
end

#paramsObject



12
13
14
# File 'lib/rsolr_ext/response/base.rb', line 12

def params
  header[:params]
end

#query_timeObject



20
21
22
# File 'lib/rsolr_ext/response/base.rb', line 20

def query_time
  header[:QTime]
end

#statusObject



16
17
18
# File 'lib/rsolr_ext/response/base.rb', line 16

def status
  header[:status].to_i
end