Class: Serpbook::Category::Rankings
- Inherits:
-
Object
- Object
- Serpbook::Category::Rankings
- Includes:
- Enumerable
- Defined in:
- lib/serpbook/category.rb
Instance Attribute Summary collapse
-
#ranks ⇒ Object
Returns the value of attribute ranks.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #for_keyword(keyword) ⇒ Object
- #for_url(url) ⇒ Object
-
#initialize(ranks) ⇒ Rankings
constructor
A new instance of Rankings.
Constructor Details
#initialize(ranks) ⇒ Rankings
Returns a new instance of Rankings.
52 53 54 |
# File 'lib/serpbook/category.rb', line 52 def initialize(ranks) self.ranks = ranks end |
Instance Attribute Details
#ranks ⇒ Object
Returns the value of attribute ranks.
50 51 52 |
# File 'lib/serpbook/category.rb', line 50 def ranks @ranks end |
Instance Method Details
#each(&block) ⇒ Object
56 57 58 |
# File 'lib/serpbook/category.rb', line 56 def each &block ranks.each(&block) end |
#for_keyword(keyword) ⇒ Object
60 61 62 |
# File 'lib/serpbook/category.rb', line 60 def for_keyword(keyword) self.class.new(ranks.select {|row| row['kw'] == keyword } ) end |
#for_url(url) ⇒ Object
64 65 66 |
# File 'lib/serpbook/category.rb', line 64 def for_url(url) self.class.new(ranks.select {|row| row['url'] == url } ) end |