Class: X2CH::Dat

Inherits:
Object
  • Object
show all
Defined in:
lib/x2ch.rb

Class Method Summary collapse

Class Method Details

.download(url, if_modified_since = nil, range = nil) ⇒ Object



209
210
211
# File 'lib/x2ch.rb', line 209

def self.download(url, if_modified_since = nil, range = nil)
	Agent.download(url, if_modified_since, range)
end

.parse(dat) ⇒ Object



213
214
215
216
217
218
219
220
221
222
# File 'lib/x2ch.rb', line 213

def self.parse(dat)
	posts = []
	dat.each_line{|l|
		m = l.match(/^(.+?)<>(.*?)<>(.*?)<>(.+)<>.*$/).to_a
		if m[0]
			posts << Post.new(m[1], m[2], m[3], m[4])
		end
	}
	posts
end