Sha256: 7a5f0ed83e83bef4179818c0469737d6acb3856a9e240faff15cd3a7c2cee8c0

Contents?: true

Size: 611 Bytes

Versions: 5

Compression:

Stored size: 611 Bytes

Contents

# encoding: UTF-8

module TmxParser
  class Document

    include Enumerable

    attr_reader :string_or_file_handle, :encoding

    def initialize(string_or_file_handle, encoding = Encoding.default_external)
      @string_or_file_handle = string_or_file_handle
      @encoding = encoding
    end

    def each(&block)
      if block_given?
        listener = Listener.new(&block)
        document = SaxDocument.new(listener)
        parser = Nokogiri::XML::SAX::Parser.new(document, encoding.to_s)
        parser.parse(string_or_file_handle)
      else
        to_enum(__method__)
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
tmx-parser-2018-1.2 lib/tmx-parser/document.rb
tmx-parser-2018-1.1.1 lib/tmx-parser/document.rb
tmx-parser-2018-1.1.0 lib/tmx-parser/document.rb
tmx-parser-1.1.0 lib/tmx-parser/document.rb
tmx-parser-1.0.1 lib/tmx-parser/document.rb