Sha256: 2019484a3ab806917465257b84c5ba29d4bbcfadd82407d4b973a3b68f481fd6

Contents?: true

Size: 662 Bytes

Versions: 3

Compression:

Stored size: 662 Bytes

Contents

require "revepast/version"
require "revepast/exceptions"
require "revepast/parser"

module Revepast
	class << self; attr_accessor :str; end

	class Parse
		attr_reader :result
		def initialize (str)
			Revepast.str = str
			parser_table = [ "EFT", "CargoScan" ]
			parser_table.each do |classname|
				begin
					parse =  Object.const_get("Revepast::Parser").const_get(classname).new
					if parse then
						result = parse.result
						bad_lines = parse.bad_lines
						@result = [classname, result, bad_lines]
						return
					end
				rescue Unparsable
					
				end
			end
			raise Unparsable.new("No valid parser found for the givin text.")
		end
	end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
revepast-1.0.2 lib/revepast.rb
revepast-0.1.0 lib/revepast.rb
revepast-0.0.3 lib/revepast.rb