Sha256: c80389741fe01c6ee82f198122ed5525fe4dbac0d774984d278e91b99d2085a0

Contents?: true

Size: 513 Bytes

Versions: 2

Compression:

Stored size: 513 Bytes

Contents

#
# my_solr_hash.extend RSolrExt::Response::Base
# my_solr_hash.header
# my_solr_hash.ok?
#
module RSolr::Ext::Response::Base
  
  def header
    self[:responseHeader]
  end
  
  def params
    header[:params]
  end
  
  def status
    header[:status].to_i
  end
  
  def query_time
    header[:QTime]
  end
  
  def ok?
    self.status == 0
  end
  
  # converts to mash, then extends
  def self.create(hash)
    mash = hash.is_a?(Mash) ? hash : hash.to_mash
    mash.extend self
    mash
  end
  
end # end Base

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mwmitchell-rsolr-ext-0.4.0 lib/rsolr-ext/response/base.rb
mwmitchell-rsolr-ext-0.4.1 lib/rsolr-ext/response/base.rb