Class: Ruby2ch::Board
- Inherits:
-
Object
- Object
- Ruby2ch::Board
- Defined in:
- lib/ruby2ch/board.rb
Instance Attribute Summary collapse
-
#links ⇒ Object
Returns the value of attribute links.
Instance Method Summary collapse
-
#initialize(url) ⇒ Board
constructor
A new instance of Board.
- #threads(num) ⇒ Object
Constructor Details
#initialize(url) ⇒ Board
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ruby2ch/board.rb', line 9 def initialize(url) @agent = Mechanize.new url = url + "subback.html" @page = @agent.get(url) @links = @page.links.map{|link| [link.href,link.text]}#.map{|link| link.split("/")[0]} @links.map!{|link,title| [link.split("/")[0],title]} @links.map!{|link,title| [url.sub("/news/subback.html","/test/read.cgi/news/") + link,title]} @links.select!{|link,title| /\/\d*$/ =~link} end |
Instance Attribute Details
#links ⇒ Object
Returns the value of attribute links.
38 39 40 |
# File 'lib/ruby2ch/board.rb', line 38 def links @links end |