Sha256: c3bb7e27c9bbcd0ec080d90b5b32f6e3f5f2b255a896829da5b5f2faeaf25f8f
Contents?: true
Size: 693 Bytes
Versions: 1
Compression:
Stored size: 693 Bytes
Contents
# Hack to load msgpack gem first so we can overwrite its to_msgpack. begin require "msgpack" rescue LoadError end # The msgpack gem adds a few modules to Ruby core classes containing :to_msgpack definition, overwriting # their default behavior. That said, we need to define the basic to_msgpack method in all of them, # otherwise they will always use to_msgpack gem implementation. [Object, NilClass, TrueClass, FalseClass, Fixnum, Bignum, Float, String, Array, Hash, Symbol].each do |klass| klass.class_eval do # Dumps object in msgpack. See http://msgpack.org for more info. def to_msgpack(options = {}) ActiveSupport::MessagePack.encode(self, options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
msgpack_rails-0.0.1 | lib/msgpack_rails/activesupport/core_ext/object/to_msgpack.rb |