Sha256: 2830abfa40a9f21236a3fc5c8cae794e599883aa4ebde505dd99668be2171cc4
Contents?: true
Size: 641 Bytes
Versions: 18
Compression:
Stored size: 641 Bytes
Contents
require "logtail/context" require "logtail/util" module Logtail module Contexts # @private class User < Context attr_reader :id, :name, :email def initialize(attributes) @id = attributes[:id] @name = attributes[:name] @email = attributes[:email] end # Builds a hash representation containing simple objects, suitable for serialization (JSON). def to_hash @to_hash ||= { user: Util::NonNilHashBuilder.build do |h| h.add(:id, id) h.add(:name, name) h.add(:email, email) end } end end end end
Version data entries
18 entries across 18 versions & 2 rubygems