Method: JustTime.parse
- Defined in:
- lib/just_time.rb
.parse(string) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/just_time.rb', line 24 def parse(string) return nil if (string.nil? || string =~ /\A\s*\Z/) begin parts = string.split(":").map{|s| Integer(s, 10) } raise if parts.size < 2 rescue raise ArgumentError, "Bad parameters passed to JustTime.parse - '#{string}'" end self.new(*parts) end |