Module: ActiveSupport::MessagePack
- Defined in:
- lib/msgpack_rails/activesupport/message_pack/decoding.rb,
lib/msgpack_rails/activesupport/message_pack/encoding.rb
Class Method Summary collapse
Class Method Details
.decode(data) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/msgpack_rails/activesupport/message_pack/decoding.rb', line 5 def self.decode(data) data = ::MessagePack.unpack(data) if ActiveSupport.parse_msgpack_times ActiveSupport::JSON.send(:convert_dates_from, data) else data end end |
.encode(value, options = nil) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/msgpack_rails/activesupport/message_pack/encoding.rb', line 6 def self.encode(value, = nil) as_msgpack_opts, out = if .is_a?(Hash) [, nil] else [nil, ] end value.as_msgpack(as_msgpack_opts).msgpack_to_msgpack(out) end |