Module: ActiveRecord::MessagePack
- Defined in:
- lib/active_record/message_pack.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Extensions Classes: Decoder, Encoder
Constant Summary collapse
- FORMAT_VERSION =
1
Class Method Summary collapse
Class Method Details
.dump(input) ⇒ Object
8 9 10 11 |
# File 'lib/active_record/message_pack.rb', line 8 def dump(input) encoder = Encoder.new [FORMAT_VERSION, encoder.encode(input), encoder.entries] end |
.load(dumped) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/active_record/message_pack.rb', line 13 def load(dumped) format_version, top_level, entries = dumped unless format_version == FORMAT_VERSION raise "Invalid format version: #{format_version.inspect}" end Decoder.new(entries).decode(top_level) end |