Class: Nicovideo::Ranking

Inherits:
Page
  • Object
show all
Defined in:
lib/nicovideo/ranking.rb

Constant Summary

Constants inherited from Page

Page::BASE_TITLE1, Page::BASE_TITLE2, Page::BASE_URL, Page::NV_DEBUG_LEVEL

Instance Method Summary collapse

Methods inherited from Page

#exists?, #html, #title=

Constructor Details

#initialize(agent, type = 'mylist', span = 'daily', category = 'all', pagenum = nil) ⇒ Ranking

Returns a new instance of Ranking.



3
4
5
6
7
8
9
10
# File 'lib/nicovideo/ranking.rb', line 3

def initialize agent, type='mylist', span='daily', category='all', pagenum=nil
  super(agent)
  @type     = type
  @category = category
  @pagenum  = pagenum
  @url      = url()
  self.register_getter ["videos"]
end

Instance Method Details

#to_aObject



20
21
22
# File 'lib/nicovideo/ranking.rb', line 20

def to_a
  videos()
end

#urlObject



12
13
14
15
16
17
18
# File 'lib/nicovideo/ranking.rb', line 12

def url
  url = "#{BASE_URL}/ranking/#{@type}/#{@span}/#{@category}"
  if @pagenum
    url += '?page=' + @pagenum.to_s
  end
  url
end