Class: RSolr::Ext::Response::Base

Inherits:
Mash
  • Object
show all
Defined in:
lib/rsolr-ext/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Mash

#[]=, #default, #delete, #dup, #fetch, #key?, #merge, #regular_update, #regular_writer, #stringify_keys!, #to_hash, #update, #values_at

Methods inherited from Hash

#to_mash

Constructor Details

#initialize(hash, handler, request_params) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
17
18
19
20
# File 'lib/rsolr-ext/response.rb', line 12

def initialize hash, handler, request_params
  super hash
  @original_hash = hash
  @request_path, @request_params = request_path, request_params
  extend Response
  extend Docs
  extend Facets
  extend Spelling
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &blk) ⇒ Object



38
39
40
# File 'lib/rsolr-ext/response.rb', line 38

def method_missing *args, &blk
  self.original_hash.send *args, &blk
end

Instance Attribute Details

#original_hashObject (readonly)

Returns the value of attribute original_hash.



9
10
11
# File 'lib/rsolr-ext/response.rb', line 9

def original_hash
  @original_hash
end

#request_paramsObject (readonly)

Returns the value of attribute request_params.



10
11
12
# File 'lib/rsolr-ext/response.rb', line 10

def request_params
  @request_params
end

#request_pathObject (readonly)

Returns the value of attribute request_path.



10
11
12
# File 'lib/rsolr-ext/response.rb', line 10

def request_path
  @request_path
end

Instance Method Details

#headerObject



22
23
24
# File 'lib/rsolr-ext/response.rb', line 22

def header
  self['responseHeader']
end

#ok?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/rsolr-ext/response.rb', line 34

def ok?
  (header and header['status']) ? header['status'] == 0 : nil
end

#paramsObject



30
31
32
# File 'lib/rsolr-ext/response.rb', line 30

def params
  (header and header['params']) ? header['params'] : request_params
end

#rowsObject



26
27
28
# File 'lib/rsolr-ext/response.rb', line 26

def rows
  params[:rows].to_i
end