Class: TimeKeeper::Parser::Meridian

Inherits:
Base
  • Object
show all
Defined in:
lib/time_keeper/parser/meridian.rb

Constant Summary collapse

TIME_FORMAT_REGEX =
/^((\d){1}|(\d){2})((:(\d){2}){1})?([ ])*(am|pm)$/i

Instance Attribute Summary

Attributes inherited from Base

#hour, #min, #time_str

Instance Method Summary collapse

Methods inherited from Base

build, #initialize, meridian_format?

Constructor Details

This class inherits a constructor from TimeKeeper::Parser::Base

Instance Method Details

#parseObject



8
9
10
11
12
13
# File 'lib/time_keeper/parser/meridian.rb', line 8

def parse
  matched_data = @time_str.match(TimeKeeper::Parser::Meridian::TIME_FORMAT_REGEX)
  extract_hour(matched_data[1], matched_data[8])
  extract_min(matched_data[4])
  self
end