Class: SmartTime::Parser::SmartParser

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_time/parser/smart_parser.rb

Direct Known Subclasses

SmartDateParser, SmartTimeParser

Class Method Summary collapse

Class Method Details

.parse(value, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/smart_time/parser/smart_parser.rb', line 5

def self.parse(value, options={})
	return _parse_with_format(value, options[:format]) if options[:format].is_a?(String)
	_default_formats.each do |format|
		result = _parse_with_format(value, format) if format.is_a?(String)
		return result if result
	end
	nil
end