Sha256: 5f0e154d3e72e946a0350091a332c1bd3af385c1c4b34413ba3d7b8fb79738f2

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module Burlap
  # Stores the resolver object for parsing burlap
  class << self
    attr_accessor :resolver
  end

  # Turns a burlap string read from `io_handle` into native
  # ruby objects.
  def self.parse(io_handle, strict = false)
    listener = Listener.new
    parser = Nokogiri::XML::SAX::Parser.new(listener)

    if strict && io_handle.encoding != Encoding::UTF_8
      io_handle.encode!(Encoding::UTF_8)
    end

    parser.parse(io_handle)
    listener.result
  end

  # Turns `obj` into a burlap XML representation
  def self.dump obj
    if obj.respond_to?(:to_burlap)
      obj.to_burlap
    else
      raise Error, "couldn't dump #{obj.inspect}"
    end
  end
end

require "base64"
require "erb"
require "core_ext/time_burlap_iso8601"

require "burlap/default_resolver"
# burlap/version already got included by gemspec
require "burlap/error"
require "burlap/array"
require "burlap/hash"

require "burlap/node"
require "burlap/core_ext" # todo: make optional?
require "burlap/base_tag"
require "burlap/fault"

require "burlap/call"
require "burlap/listener"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
burlap-1.0.0 lib/burlap.rb