Sha256: 17f87b9c7649d1188890cbc430d4a41c58720d77d2c6e19de8cfd869dce5489c
Contents?: true
Size: 796 Bytes
Versions: 32
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true require "dry-transformer" require "json" module DjiMqttConnect module Thing::Product class EventsReplyMarshal < MessageMarshal # Renames the method attribute class HashTransformer < Dry::Transformer::Pipe import Dry::Transformer::HashTransformations define! do rename_keys _method: :method end end # Converts a message for transmission via MQTT def dump(message) # Fix up the hash representation transformed_message = hash_transformer.call(message) # Convert the transformed message into JSON JSON.generate(transformed_message) end private def hash_transformer @hash_transformer ||= HashTransformer.new end end end end
Version data entries
32 entries across 32 versions & 1 rubygems