Class: Datte::DateParser
- Inherits:
-
Object
- Object
- Datte::DateParser
- Defined in:
- lib/datte/date_parser.rb
Instance Method Summary collapse
-
#initialize(body, options = {}) ⇒ DateParser
constructor
A new instance of DateParser.
- #parse ⇒ Object
Constructor Details
#initialize(body, options = {}) ⇒ DateParser
Returns a new instance of DateParser.
3 4 5 6 7 |
# File 'lib/datte/date_parser.rb', line 3 def initialize(body, = {}) @body = body @options = @date = Dattetime.new end |
Instance Method Details
#parse ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datte/date_parser.rb', line 9 def parse ABSOLUTE_DATES.each do |matcher| if md = @body.match(matcher) @date.update_date(md) p @date p @date.year p @date.month p @date.day p md break end end return @date.to_datetime # MATCHER.each do |matcher| # @body.match(matcher) do |md| # y = year(md) # m = month(md) # d = day(md) # #h = hour(md) # #m = minute(md) # # @md = md # return y, m, d # end # end end |