Class: X2CH::Thread
- Inherits:
-
Object
- Object
- X2CH::Thread
- Defined in:
- lib/x2ch.rb
Instance Attribute Summary collapse
-
#dat ⇒ Object
Returns the value of attribute dat.
-
#name ⇒ Object
Returns the value of attribute name.
-
#num ⇒ Object
Returns the value of attribute num.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #each(&blk) ⇒ Object
-
#initialize(url, dat, name, num) ⇒ Thread
constructor
A new instance of Thread.
- #posts(if_modified_since = nil, range = nil) ⇒ Object
Constructor Details
#initialize(url, dat, name, num) ⇒ Thread
Returns a new instance of Thread.
85 86 87 |
# File 'lib/x2ch.rb', line 85 def initialize(url, dat, name, num) @url, @dat, @name, @num = url, dat, name, num end |
Instance Attribute Details
#dat ⇒ Object
Returns the value of attribute dat.
83 84 85 |
# File 'lib/x2ch.rb', line 83 def dat @dat end |
#name ⇒ Object
Returns the value of attribute name.
83 84 85 |
# File 'lib/x2ch.rb', line 83 def name @name end |
#num ⇒ Object
Returns the value of attribute num.
83 84 85 |
# File 'lib/x2ch.rb', line 83 def num @num end |
#url ⇒ Object
Returns the value of attribute url.
83 84 85 |
# File 'lib/x2ch.rb', line 83 def url @url end |
Instance Method Details
#each(&blk) ⇒ Object
99 100 101 102 103 |
# File 'lib/x2ch.rb', line 99 def each(&blk) posts.each{|p| yield p } end |
#posts(if_modified_since = nil, range = nil) ⇒ Object
89 90 91 92 93 94 95 96 97 |
# File 'lib/x2ch.rb', line 89 def posts(if_modified_since = nil, range = nil) if @url.match(/machi.to/) part = @url.match(/^(http:\/\/.+?)\/(.+?)\//).to_a res = Dat.download(part[1] + "/bbs/offlaw.cgi/" + part[2] + '/' + @dat.sub('.cgi', ''), if_modified_since, range) else res = Dat.download(@url + "dat/" + @dat, if_modified_since, range) end ArrayResponse.new(Dat.parse(res), res.status, res.last_modified, res.content_encoding, res.body_size) end |