Class: Magick::PerformanceMetrics::Metric
- Inherits:
-
Object
- Object
- Magick::PerformanceMetrics::Metric
- Defined in:
- lib/magick/performance_metrics.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#feature_name ⇒ Object
readonly
Returns the value of attribute feature_name.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(feature_name, operation, duration, success: true) ⇒ Metric
constructor
A new instance of Metric.
- #to_h ⇒ Object
Constructor Details
#initialize(feature_name, operation, duration, success: true) ⇒ Metric
Returns a new instance of Metric.
8 9 10 11 12 13 14 |
# File 'lib/magick/performance_metrics.rb', line 8 def initialize(feature_name, operation, duration, success: true) @feature_name = feature_name.to_s @operation = operation.to_s @duration = duration = Time.now @success = success end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
6 7 8 |
# File 'lib/magick/performance_metrics.rb', line 6 def duration @duration end |
#feature_name ⇒ Object (readonly)
Returns the value of attribute feature_name.
6 7 8 |
# File 'lib/magick/performance_metrics.rb', line 6 def feature_name @feature_name end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
6 7 8 |
# File 'lib/magick/performance_metrics.rb', line 6 def operation @operation end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
6 7 8 |
# File 'lib/magick/performance_metrics.rb', line 6 def success @success end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/magick/performance_metrics.rb', line 6 def end |
Instance Method Details
#to_h ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/magick/performance_metrics.rb', line 16 def to_h { feature_name: feature_name, operation: operation, duration: duration, timestamp: .iso8601, success: success } end |