Class: Zinx::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/zinx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sphinx_hash) ⇒ Result

Returns a new instance of Result.



234
235
236
237
238
239
240
241
242
# File 'lib/zinx.rb', line 234

def initialize(sphinx_hash)
  @matches = []
  @sphinx_hash = sphinx_hash
  if @sphinx_hash.has_key?("matches")
    @sphinx_hash["matches"].each do |match|
      @matches << Match.new(match)
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



244
245
246
# File 'lib/zinx.rb', line 244

def method_missing(method)
  @sphinx_hash["#{method}"]
end

Instance Attribute Details

#matchesObject (readonly)

Returns the value of attribute matches.



232
233
234
# File 'lib/zinx.rb', line 232

def matches
  @matches
end