Class: Serpbook::Category::Rankings

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/serpbook/category.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ranksObject

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