Sha256: ea6c1735de7c5e509a2c5170c646c9dd4fd089e240881d969ad1c9c0ffffb109
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
require 'open-uri' require 'stringio' require 'zlib' module Weskit::WML class Parser private_class_method :new class << self def string str parse str end def uri uri begin str = open(uri).read rescue raise Errrors::ReadError, "Couldn't open URI" ensure str = Zlib::GzipReader.new(StringIO.new str).read rescue str end parse str end private def parse data parser = KPEGParser.new "#{data}\n" unless parser.parse msg = "#{parser.failure_character} #{parser.failure_info}" raise Errors::ParseError, msg end parser.result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
weskit-0.2.0 | lib/weskit/wml/parser.rb |