Class: Freebase::Response
- Inherits:
-
Object
- Object
- Freebase::Response
- Includes:
- Enumerable
- Defined in:
- lib/freebase/response.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(response_body) ⇒ Response
constructor
A new instance of Response.
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
#results ⇒ Object (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 |