Sha256: 82f2322346ca647d0c3401eb75748ce979ae8c2df099f7635337032f9f3fc7fc

Contents?: true

Size: 1.04 KB

Versions: 29

Compression:

Stored size: 1.04 KB

Contents

require "msgpack/version"

if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" # This is same with `/java/ =~ RUBY_VERSION`
  require "java"
  require "msgpack/msgpack.jar"
  org.msgpack.jruby.MessagePackLibrary.new.load(JRuby.runtime, false)
else
  begin
    require "msgpack/#{RUBY_VERSION[/\d+.\d+/]}/msgpack"
  rescue LoadError
    require "msgpack/msgpack"
  end
end

require "msgpack/packer"
require "msgpack/unpacker"
require "msgpack/factory"
require "msgpack/symbol"
require "msgpack/core_ext"

module MessagePack
  DefaultFactory = MessagePack::Factory.new

  def load(src, param = nil)
    unpacker = nil

    if src.is_a? String
      unpacker = DefaultFactory.unpacker param
      unpacker.feed src
    else
      unpacker = DefaultFactory.unpacker src, param
    end

    unpacker.full_unpack
  end
  alias :unpack :load

  module_function :load
  module_function :unpack

  def pack(v, *rest)
    packer = DefaultFactory.packer(*rest)
    packer.write v
    packer.full_pack
  end
  alias :dump :pack

  module_function :pack
  module_function :dump
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
msgpack-1.2.7-x64-mingw32 lib/msgpack.rb
msgpack-1.2.7-x86-mingw32 lib/msgpack.rb
msgpack-1.2.7-java lib/msgpack.rb
msgpack-1.2.7 lib/msgpack.rb
msgpack-1.2.6-java lib/msgpack.rb
msgpack-1.2.6 lib/msgpack.rb
msgpack-1.2.6-x86-mingw32 lib/msgpack.rb
msgpack-1.2.6-x64-mingw32 lib/msgpack.rb
msgpack-1.2.5-java lib/msgpack.rb
msgpack-1.2.5-x86-mingw32 lib/msgpack.rb
msgpack-1.2.5-x64-mingw32 lib/msgpack.rb
msgpack-1.2.5 lib/msgpack.rb
msgpack-1.2.4-java lib/msgpack.rb
msgpack-1.2.4-x64-mingw32 lib/msgpack.rb
msgpack-1.2.4-x86-mingw32 lib/msgpack.rb
msgpack-1.2.4 lib/msgpack.rb
msgpack-1.2.3-java lib/msgpack.rb
msgpack-1.2.3-x64-mingw32 lib/msgpack.rb
msgpack-1.2.3-x86-mingw32 lib/msgpack.rb
msgpack-1.2.3 lib/msgpack.rb