Class: RailsPulse::Requests::Charts::OperationsChart
- Inherits:
-
Object
- Object
- RailsPulse::Requests::Charts::OperationsChart
- Defined in:
- app/models/rails_pulse/requests/charts/operations_chart.rb
Defined Under Namespace
Classes: OperationBar
Constant Summary collapse
- HORIZONTAL_OFFSET_PX =
20
Instance Attribute Summary collapse
-
#bars ⇒ Object
readonly
Returns the value of attribute bars.
-
#max_end ⇒ Object
readonly
Returns the value of attribute max_end.
-
#min_start ⇒ Object
readonly
Returns the value of attribute min_start.
-
#total_duration ⇒ Object
readonly
Returns the value of attribute total_duration.
Instance Method Summary collapse
-
#initialize(operations) ⇒ OperationsChart
constructor
A new instance of OperationsChart.
Constructor Details
#initialize(operations) ⇒ OperationsChart
Returns a new instance of OperationsChart.
11 12 13 14 15 16 17 |
# File 'app/models/rails_pulse/requests/charts/operations_chart.rb', line 11 def initialize(operations) @operations = operations @min_start = @operations.map(&:start_time).min || 0 @max_end = @operations.map { |op| op.start_time + op.duration }.max || 1 @total_duration = (@max_end - @min_start).nonzero? || 1 @bars = end |
Instance Attribute Details
#bars ⇒ Object (readonly)
Returns the value of attribute bars.
7 8 9 |
# File 'app/models/rails_pulse/requests/charts/operations_chart.rb', line 7 def @bars end |
#max_end ⇒ Object (readonly)
Returns the value of attribute max_end.
7 8 9 |
# File 'app/models/rails_pulse/requests/charts/operations_chart.rb', line 7 def max_end @max_end end |
#min_start ⇒ Object (readonly)
Returns the value of attribute min_start.
7 8 9 |
# File 'app/models/rails_pulse/requests/charts/operations_chart.rb', line 7 def min_start @min_start end |
#total_duration ⇒ Object (readonly)
Returns the value of attribute total_duration.
7 8 9 |
# File 'app/models/rails_pulse/requests/charts/operations_chart.rb', line 7 def total_duration @total_duration end |