Class: LogStruct::Log::CarrierWave::Upload
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::CarrierWave::Upload
- Extended by:
- T::Sig
- Includes:
- Interfaces::CommonFields, Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/carrierwave/upload.rb
Instance Attribute Summary collapse
-
#duration_ms ⇒ Float?
readonly
Returns the value of prop
duration_ms. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#file_id ⇒ String
readonly
Returns the value of prop
file_id. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#metadata ⇒ Hash{String => T.untyped}?
readonly
Returns the value of prop
metadata. -
#mime_type ⇒ String?
readonly
Event-specific fields.
-
#model ⇒ String?
readonly
Returns the value of prop
model. -
#mount_point ⇒ String?
readonly
Returns the value of prop
mount_point. -
#size ⇒ Integer?
readonly
Returns the value of prop
size. -
#source ⇒ Source::CarrierWave
readonly
Shared/common fields.
-
#storage ⇒ Symbol
readonly
Returns the value of prop
storage. -
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp. -
#uploader ⇒ String?
readonly
Returns the value of prop
uploader. -
#version ⇒ String?
readonly
Returns the value of prop
version.
Instance Method Summary collapse
- #initialize(source: Source::CarrierWave, event: Event::Upload, timestamp:, level: Level::Info, storage:, file_id:, uploader: nil, model: nil, mount_point: nil, version: nil, mime_type: nil, size: nil, metadata: nil, duration_ms: nil) ⇒ void constructor
- #to_h ⇒ Hash{LogStruct::LogField => T.untyped}
Methods included from Shared::SerializeCommon
#as_json, #serialize, #serialize_common
Methods included from Interfaces::CommonFieldBase
Constructor Details
#initialize(source: Source::CarrierWave, event: Event::Upload, timestamp:, level: Level::Info, storage:, file_id:, uploader: nil, model: nil, mount_point: nil, version: nil, mime_type: nil, size: nil, metadata: nil, duration_ms: nil) ⇒ void
|
|
# File '' const :source, Source::CarrierWave, default: Source::CarrierWave, override: true const :event, Event, default: Event::Upload, override: true const :timestamp, Time, factory: -> { Time.now }, override: true const :level, Level, default: Level::Info, override: true const :storage, Symbol const :file_id, String const :uploader, T.nilable(String), default: nil const :model, T.nilable(String), default: nil const :mount_point, T.nilable(String), default: nil const :version, T.nilable(String), default: nil const :mime_type, T.nilable(String), default: nil const :size, T.nilable(Integer), default: nil const :metadata, T.nilable(T::Hash[String, T.untyped]), default: nil const :duration_ms, T.nilable(Float), default: nil |
Instance Attribute Details
#duration_ms ⇒ Float? (readonly)
Returns the value of prop duration_ms.
|
|
# File '' const :duration_ms, T.nilable(Float), default: nil |
#event ⇒ Event (readonly)
Returns the value of prop event.
|
|
# File '' const :event, Event, default: Event::Upload, override: true |
#file_id ⇒ String (readonly)
Returns the value of prop file_id.
|
|
# File '' const :file_id, String |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info, override: true |
#metadata ⇒ Hash{String => T.untyped}? (readonly)
Returns the value of prop metadata.
|
|
# File '' const :metadata, T.nilable(T::Hash[String, T.untyped]), default: nil |
#mime_type ⇒ String? (readonly)
Event-specific fields
|
|
# File '' const :mime_type, T.nilable(String), default: nil |
#model ⇒ String? (readonly)
Returns the value of prop model.
|
|
# File '' const :model, T.nilable(String), default: nil |
#mount_point ⇒ String? (readonly)
Returns the value of prop mount_point.
|
|
# File '' const :mount_point, T.nilable(String), default: nil |
#size ⇒ Integer? (readonly)
Returns the value of prop size.
|
|
# File '' const :size, T.nilable(Integer), default: nil |
#source ⇒ Source::CarrierWave (readonly)
Shared/common fields
|
|
# File '' const :source, Source::CarrierWave, default: Source::CarrierWave, override: true |
#storage ⇒ Symbol (readonly)
Returns the value of prop storage.
|
|
# File '' const :storage, Symbol |
#timestamp ⇒ Time (readonly)
Returns the value of prop timestamp.
|
|
# File '' const :timestamp, Time, factory: -> { Time.now }, override: true |
#uploader ⇒ String? (readonly)
Returns the value of prop uploader.
|
|
# File '' const :uploader, T.nilable(String), default: nil |
#version ⇒ String? (readonly)
Returns the value of prop version.
|
|
# File '' const :version, T.nilable(String), default: nil |
Instance Method Details
#to_h ⇒ Hash{LogStruct::LogField => T.untyped}
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/log_struct/log/carrierwave/upload.rb', line 52 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Storage] = storage h[LogField::FileId] = file_id h[LogField::Uploader] = uploader unless uploader.nil? h[LogField::Model] = model unless model.nil? h[LogField::MountPoint] = mount_point unless mount_point.nil? h[LogField::Version] = version unless version.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 end |