Class: Metrocot::Scanners::DateTimeScanner

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

Overview

Scans the hpricot element or text for a date in one of the various formats accepted by Time. Dependingon the kinds of dates expected in the doc, this may not be sufficient and you may have to create a custom scanner.

Instance Method Summary collapse

Instance Method Details

#scan(data) ⇒ Object



1080
1081
1082
1083
1084
1085
# File 'lib/metrocot.rb', line 1080

def scan( data )
	if data.is_a? Hpricot::Elem
		data = data.inner_text
	end
	Time.parse(data)
end