Class: Protojson::Codec::JsonTagMap

Inherits:
Object
  • Object
show all
Extended by:
CodecInterface
Defined in:
lib/protojson/codec/json_tag_map.rb

Class Method Summary collapse

Methods included from CodecInterface

decode, encode

Class Method Details

.decode(message, data) ⇒ Object



16
17
18
19
# File 'lib/protojson/codec/json_tag_map.rb', line 16

def decode(message, data)
  data.is_a?(String) and data = ActiveSupport::JSON.decode(data)
  Protojson::Codec::Hash.decode(message, data, :tag)
end

.encode(message) ⇒ Object



12
13
14
# File 'lib/protojson/codec/json_tag_map.rb', line 12

def encode(message)
  Protojson::Codec::Hash.encode(message, :tag).to_json
end