Class: Freebase::Response

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/freebase/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body) ⇒ Response

Returns a new instance of Response.



6
7
8
9
10
# File 'lib/freebase/response.rb', line 6

def initialize(response_body)
  info = response_body["messages"].first["info"]
  @results = info["result"].map { |result| Freebase::Result.new(result) }
  @size = info["count"]
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



4
5
6
# File 'lib/freebase/response.rb', line 4

def results
  @results
end

Instance Method Details

#each(&block) ⇒ Object



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

def each(&block)
  @results.each(&block)
end