Method: Kit::DateParser#parse
- Defined in:
- lib/kit/date_parser.rb
#parse(element) ⇒ Date?
Returns the first date, if any, in the given element‘s text
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kit/date_parser.rb', line 17 def parse(element) part_with_date = element.text.split(' ').find do |date_string| begin string_to_date(date_string) rescue ArgumentError end end if part_with_date string_to_date(part_with_date) end end |