Class: Grafana::RangeWithDefaults
- Inherits:
-
Object
- Object
- Grafana::RangeWithDefaults
- Defined in:
- lib/grafana/time_window.rb
Overview
For incomplete time ranges, adds default parameters to achieve a complete range. If both full range is provided, range will be returned.
Constant Summary collapse
- DEFAULT_RANGE =
8.hours
Instance Method Summary collapse
-
#initialize(from: nil, to: nil) ⇒ RangeWithDefaults
constructor
A new instance of RangeWithDefaults.
- #to_hash ⇒ Object
Constructor Details
#initialize(from: nil, to: nil) ⇒ RangeWithDefaults
Returns a new instance of RangeWithDefaults.
55 56 57 58 59 60 |
# File 'lib/grafana/time_window.rb', line 55 def initialize(from: nil, to: nil) @from = from @to = to apply_defaults! end |
Instance Method Details
#to_hash ⇒ Object
62 63 64 |
# File 'lib/grafana/time_window.rb', line 62 def to_hash { from: @from, to: @to }.compact end |