Sha256: 0ae06d7aae68554bc1d6536b772a54315c0740b15cd19d6f6d722490cc8ba105
Contents?: true
Size: 854 Bytes
Versions: 1
Compression:
Stored size: 854 Bytes
Contents
require 'polyglot' require 'treetop' 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, "Coldn't open URI" ensure str = Zlib::GzipReader.new(StringIO.new str).read rescue str end parse str end private def parse data parsed = parser.parse data.strip, :consume_all_input => false unless parsed msg = parser.failure_reason or 'Invalid data' raise Errors::ParseError, msg end parsed.wml end def parser @parser ||= WesnothMarkupLanguageParser.new end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
weskit-0.1.0 | lib/weskit/wml/parser.rb |