Class: Railswatch::Widgets::ResourceChart
- Defined in:
- lib/railswatch/widgets/resource_chart.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Chart
#description, #legend, #subtitle, #units
Attributes inherited from Base
Instance Method Summary collapse
- #data ⇒ Object
- #format(measurement) ⇒ Object
- #id ⇒ Object
-
#initialize(server, key:, type:) ⇒ ResourceChart
constructor
A new instance of ResourceChart.
- #signal(event) ⇒ Object
Methods inherited from Chart
Methods inherited from Base
Constructor Details
#initialize(server, key:, type:) ⇒ ResourceChart
Returns a new instance of ResourceChart.
8 9 10 11 12 13 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 8 def initialize(server, key:, type:, **) super(nil) @server = server @key = key @type = type end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 6 def key @key end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
6 7 8 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 6 def server @server end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 6 def type @type end |
Instance Method Details
#data ⇒ Object
19 20 21 22 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 19 def data all_data = server.report.extract_signal { |event| signal(event) } all_data[server.key] end |
#format(measurement) ⇒ Object
28 29 30 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 28 def format(measurement) measurement end |
#id ⇒ Object
15 16 17 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 15 def id [key, 'report', server.key.parameterize].join('_') end |
#signal(event) ⇒ Object
24 25 26 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 24 def signal(event) format(event[key]) end |