Class: LogStruct::Log::ActiveStorage::Download
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::ActiveStorage::Download
- Extended by:
- T::Sig
- Includes:
- Interfaces::CommonFields, Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/active_storage/download.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. -
#filename ⇒ String?
readonly
Event-specific fields.
-
#level ⇒ Level
readonly
Returns the value of prop
level. -
#range ⇒ String?
readonly
Returns the value of prop
range. -
#source ⇒ Source::Storage
readonly
Shared/common fields.
-
#storage ⇒ Symbol
readonly
Returns the value of prop
storage. -
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp.
Instance Method Summary collapse
- #initialize(source: Source::Storage, event: Event::Download, timestamp:, level: Level::Info, storage:, file_id:, filename: nil, range: 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::CommonFields
Constructor Details
#initialize(source: Source::Storage, event: Event::Download, timestamp:, level: Level::Info, storage:, file_id:, filename: nil, range: nil, duration_ms: nil) ⇒ void
|
|
# File '' const :source, Source::Storage, default: Source::Storage const :event, Event, default: Event::Download const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :storage, Symbol const :file_id, String const :filename, T.nilable(String), default: nil const :range, T.nilable(String), 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::Download |
#file_id ⇒ String (readonly)
Returns the value of prop file_id.
|
|
# File '' const :file_id, String |
#filename ⇒ String? (readonly)
Event-specific fields
|
|
# File '' const :filename, T.nilable(String), default: nil |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info |
#range ⇒ String? (readonly)
Returns the value of prop range.
|
|
# File '' const :range, T.nilable(String), default: nil |
#source ⇒ Source::Storage (readonly)
Shared/common fields
|
|
# File '' const :source, Source::Storage, default: Source::Storage |
#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 } |
Instance Method Details
#to_h ⇒ Hash{LogStruct::LogField => T.untyped}
45 46 47 48 49 50 51 52 53 |
# File 'lib/log_struct/log/active_storage/download.rb', line 45 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::Range] = range unless range.nil? h[LogField::DurationMs] = duration_ms unless duration_ms.nil? h end |