Sha256: b451ba11c2e7065f22e4b32cba0b80bac8a0a2a400b20541c28ec3c39cbe2c7d

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

module FFI_Yajl
  class ParseError < StandardError; end
  class Parser
    attr_accessor :stack, :key_stack, :key, :finished

    attr_accessor :opts

    #
    # stack used to build up our complex object
    #
    def stack
      @stack ||= Array.new
    end

    #
    # stack to keep track of keys as we create nested hashes
    #
    def key_stack
      @key_stack ||= Array.new
    end

    def self.parse(obj, *args)
      new(*args).parse(obj)
    end

    def initialize(opts = {})
      @opts = opts
    end

    def parse(str)
      # initialization that we can do in pure ruby
      yajl_opts = {}

      # XXX: bug-compat with ruby-yajl
      return nil if str == ""

      # call either the ext or ffi hook
      do_yajl_parse(str, yajl_opts)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-yajl-0.1.7 lib/ffi_yajl/parser.rb
ffi-yajl-0.1.7-universal-java lib/ffi_yajl/parser.rb