Method: ActiveSupport::MessagePack::Extensions#install

Defined in:
lib/active_support/message_pack/extensions.rb

#install(registry) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/active_support/message_pack/extensions.rb', line 21

def install(registry)
  registry.register_type 0, Symbol,
    packer: :to_msgpack_ext,
    unpacker: :from_msgpack_ext,
    optimized_symbols_parsing: true

  registry.register_type 1, Integer,
    packer: ::MessagePack::Bigint.method(:to_msgpack_ext),
    unpacker: ::MessagePack::Bigint.method(:from_msgpack_ext),
    oversized_integer_extension: true

  registry.register_type 2, BigDecimal,
    packer: :_dump,
    unpacker: :_load

  registry.register_type 3, Rational,
    packer: method(:write_rational),
    unpacker: method(:read_rational),
    recursive: true

  registry.register_type 4, Complex,
    packer: method(:write_complex),
    unpacker: method(:read_complex),
    recursive: true

  registry.register_type 5, DateTime,
    packer: method(:write_datetime),
    unpacker: method(:read_datetime),
    recursive: true

  registry.register_type 6, Date,
    packer: method(:write_date),
    unpacker: method(:read_date),
    recursive: true

  registry.register_type 7, Time,
    packer: method(:write_time),
    unpacker: method(:read_time),
    recursive: true

  registry.register_type 8, ActiveSupport::TimeWithZone,
    packer: method(:write_time_with_zone),
    unpacker: method(:read_time_with_zone),
    recursive: true

  registry.register_type 9, ActiveSupport::TimeZone,
    packer: method(:dump_time_zone),
    unpacker: method(:load_time_zone)

  registry.register_type 10, ActiveSupport::Duration,
    packer: method(:write_duration),
    unpacker: method(:read_duration),
    recursive: true

  registry.register_type 11, Range,
    packer: method(:write_range),
    unpacker: method(:read_range),
    recursive: true

  registry.register_type 12, Set,
    packer: method(:write_set),
    unpacker: method(:read_set),
    recursive: true

  registry.register_type 13, URI::Generic,
    packer: :to_s,
    unpacker: URI.method(:parse)

  registry.register_type 14, IPAddr,
    packer: method(:write_ipaddr),
    unpacker: method(:read_ipaddr),
    recursive: true

  registry.register_type 15, Pathname,
    packer: :to_s,
    unpacker: :new

  registry.register_type 16, Regexp,
    packer: :to_s,
    unpacker: :new

  registry.register_type 17, ActiveSupport::HashWithIndifferentAccess,
    packer: method(:write_hash_with_indifferent_access),
    unpacker: method(:read_hash_with_indifferent_access),
    recursive: true

  registry.register_type 18, ActiveSupport::SafeBuffer,
    packer: :to_s,
    unpacker: :new
end