Class: Wikidata::Response
- Inherits:
-
Object
- Object
- Wikidata::Response
- Extended by:
- Forwardable
- Defined in:
- lib/wikidata/response.rb
Direct Known Subclasses
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(raw) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize(raw) ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/wikidata/response.rb', line 7 def initialize raw @raw = raw end |
Instance Method Details
#empty? ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'lib/wikidata/response.rb', line 16 def empty? @_empty ||= ( @raw.body['entities'].nil? || @raw.body['entities'].is_a?(Array) && @raw.body['entities'].empty? || @raw.body['entities'].is_a?(String) ) end |
#inspect ⇒ Object
24 25 26 |
# File 'lib/wikidata/response.rb', line 24 def inspect "<#{self.class} results: #{results.inspect}>" end |