Class: Trendious::Tags
- Inherits:
-
Collection
- Object
- Collection
- Trendious::Tags
- Defined in:
- lib/trendious/tags.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #entries ⇒ Object
- #find(name) ⇒ Object
-
#initialize(res) ⇒ Tags
constructor
A new instance of Tags.
Methods inherited from Collection
Constructor Details
#initialize(res) ⇒ Tags
Returns a new instance of Tags.
5 6 7 |
# File 'lib/trendious/tags.rb', line 5 def initialize(res) @response = JSON.parse(res) end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/trendious/tags.rb', line 3 def response @response end |
Instance Method Details
#entries ⇒ Object
9 10 11 |
# File 'lib/trendious/tags.rb', line 9 def entries @response['collection'].map {|h| Tag.new h } end |
#find(name) ⇒ Object
13 14 15 |
# File 'lib/trendious/tags.rb', line 13 def find(name) entries.select {|tag| tag.name.downcase.include? name.downcase } end |