Class: String

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

Instance Method Summary collapse

Instance Method Details

#to_date ⇒ Object

Use NSDataDetector to parse a string containing a date or duration. These can be of the form:

"tomorrow at 7:30 PM" "11.23.2013" "from 7:30 to 10:00 AM"

etc.



55
56
57
# File 'lib/motion_model/date_parser.rb', line 55

def to_date
  DateParser.parse_date(self)
end

#to_duration ⇒ Object



63
64
65
# File 'lib/motion_model/date_parser.rb', line 63

def to_duration
  DateParser.parse_duration(self)
end

#to_timezone ⇒ Object



59
60
61
# File 'lib/motion_model/date_parser.rb', line 59

def to_timezone
  DateParser.parse_time_zone(self)
end