Class: RailsOrbit::TimeRange
- Inherits:
-
Object
- Object
- RailsOrbit::TimeRange
- Defined in:
- lib/rails_orbit/time_range.rb
Constant Summary collapse
- OPTIONS =
{ "1h" => { minutes: 60, bucket_minutes: 1, delta_window: 15.minutes, label: "1h" }, "6h" => { minutes: 360, bucket_minutes: 5, delta_window: 1.hour, label: "6h" }, "24h" => { minutes: 1440, bucket_minutes: 15, delta_window: 1.hour, label: "24h" }, "7d" => { minutes: 10080, bucket_minutes: 60, delta_window: 6.hours, label: "7d" }, "30d" => { minutes: 43200, bucket_minutes: 360, delta_window: 1.day, label: "30d" }, }.freeze
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #bucket_minutes ⇒ Object
- #delta_window ⇒ Object
-
#initialize(param) ⇒ TimeRange
constructor
A new instance of TimeRange.
- #label ⇒ Object
- #since ⇒ Object
Constructor Details
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
11 12 13 |
# File 'lib/rails_orbit/time_range.rb', line 11 def key @key end |
Instance Method Details
#bucket_minutes ⇒ Object
21 22 23 |
# File 'lib/rails_orbit/time_range.rb', line 21 def bucket_minutes config[:bucket_minutes] end |
#delta_window ⇒ Object
25 26 27 |
# File 'lib/rails_orbit/time_range.rb', line 25 def delta_window config[:delta_window] end |
#label ⇒ Object
29 30 31 |
# File 'lib/rails_orbit/time_range.rb', line 29 def label config[:label] end |
#since ⇒ Object
17 18 19 |
# File 'lib/rails_orbit/time_range.rb', line 17 def since config[:minutes].minutes.ago end |