Class: LogStruct::Log::ActiveModelSerializers

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Includes:
Interfaces::CommonFields, Shared::SerializeCommon
Defined in:
lib/log_struct/log/active_model_serializers.rb

Instance Method Summary collapse

Methods included from Shared::SerializeCommon

#as_json, #serialize, #serialize_common

Methods included from Interfaces::CommonFields

#event, #source

Methods included from Interfaces::CommonFieldBase

#level, #serialize, #timestamp

Instance Method Details

#to_hObject



43
44
45
46
47
48
49
50
51
# File 'lib/log_struct/log/active_model_serializers.rb', line 43

def to_h
  h = T.let({}, T::Hash[LogStruct::LogField, T.untyped])
  h[LogField::Message] = message
  h[LogField::Serializer] = serializer unless serializer.nil?
  h[LogField::Adapter] = adapter unless adapter.nil?
  h[LogField::ResourceClass] = resource_class unless resource_class.nil?
  h[LogField::DurationMs] = duration_ms
  h
end