Class: LogStruct::Log::ActiveStorage::Upload

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Includes:
Interfaces::CommonFields, Shared::SerializeCommon
Defined in:
lib/log_struct/log/active_storage/upload.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



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/log_struct/log/active_storage/upload.rb', line 48

def to_h
  h = T.let({}, T::Hash[LogStruct::LogField, T.untyped])
  h[LogField::Storage] = storage
  h[LogField::FileId] = file_id
  h[LogField::Filename] = filename unless filename.nil?
  h[LogField::MimeType] = mime_type unless mime_type.nil?
  h[LogField::Size] = size unless size.nil?
  h[LogField::Metadata] =  unless .nil?
  h[LogField::DurationMs] = duration_ms unless duration_ms.nil?
  h[LogField::Checksum] = checksum unless checksum.nil?
  h
end