module ActiveRecord::MessagePack::Extensions
Public Instance Methods
# File activerecord/lib/active_record/message_pack.rb, line 25 def install(registry) registry.register_type 118, ActiveRecord::Type::Time::Value, packer: method(:write_time_value), unpacker: method(:read_time_value), recursive: true registry.register_type 119, ActiveModel::Type::Binary::Data, packer: :to_s, unpacker: :new registry.register_type 120, ActiveRecord::Base, packer: method(:write_record), unpacker: method(:read_record), recursive: true end
# File activerecord/lib/active_record/message_pack.rb, line 53 def read_record(unpacker) ActiveRecord::MessagePack.load(unpacker.read) end
# File activerecord/lib/active_record/message_pack.rb, line 45 def read_time_value(unpacker) ActiveRecord::Type::Time::Value.new(unpacker.read) end
# File activerecord/lib/active_record/message_pack.rb, line 49 def write_record(record, packer) packer.write(ActiveRecord::MessagePack.dump(record)) end
# File activerecord/lib/active_record/message_pack.rb, line 41 def write_time_value(value, packer) packer.write(value.__getobj__) end