class Solr4R::Result
Attributes
response[R]
Public Class Methods
new(response, hash)
click to toggle source
# File lib/solr4r/result.rb 47 def initialize(response, hash) 48 @response, @hash = response, hash.extend(Nuggets::Hash::DeepFetchMixin) 49 50 self.class.types.each { |key, mod| 51 extend(mod) if val = hash.key?(key) 52 53 respond_to?(meth = "#{key}?", true) or 54 define_singleton_method(meth) { val } 55 } 56 end
types()
click to toggle source
# File lib/solr4r/result.rb 40 def self.types 41 @types ||= constants.each_with_object({}) { |const, hash| 42 mod, key = const_get(const), const.to_s; next unless mod.is_a?(Module) 43 hash[key.extend(Nuggets::String::CamelscoreMixin).underscore!] = mod 44 } 45 end
Public Instance Methods
each(&block)
click to toggle source
# File lib/solr4r/result.rb 72 def each(&block) 73 block ? _each(&block) : enum_for(__method__) 74 end
empty?()
click to toggle source
# File lib/solr4r/result.rb 76 def empty? 77 to_i.zero? 78 end
to_hash()
click to toggle source
# File lib/solr4r/result.rb 64 def to_hash 65 @hash 66 end
to_i()
click to toggle source
# File lib/solr4r/result.rb 68 def to_i 69 0 70 end
Private Instance Methods
_each()
click to toggle source
# File lib/solr4r/result.rb 82 def _each 83 [] 84 end