Sha256: 3734e60a18a493d7ae831d8318507e7a881cd3b82a52d78480a41631c615fc1f

Contents?: true

Size: 362 Bytes

Versions: 2

Compression:

Stored size: 362 Bytes

Contents

require 'polyglot'
require 'treetop'
Treetop.load File.join(File.dirname(__FILE__), 'timeparsing.treetop')

module Timeparser
  class Parser
    def parser
      @parser ||= TimeparsingParser.new
    end

    def parse(string)
      if result = parser.parse(string.strip)
        Time.new(result.value)
      else
        Time.new(0)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timeparser-0.0.3 lib/timeparser/parser.rb
timeparser-0.0.2 lib/timeparser/parser.rb