Class: Daytona::Charts::Chart
- Inherits:
-
Object
- Object
- Daytona::Charts::Chart
- Defined in:
- lib/daytona/common/charts.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#elements ⇒ Array<Object>
readonly
The elements of the chart.
-
#png ⇒ String, Nil
readonly
The PNG representation of the chart encoded in base64.
-
#title ⇒ String, Nil
readonly
The title of the chart.
-
#type ⇒ String, Nil
readonly
The type of chart.
Instance Method Summary collapse
-
#initialize(data) ⇒ Chart
constructor
A new instance of Chart.
-
#to_h ⇒ Hash<Symbol, Object>
Original metadata.
Constructor Details
#initialize(data) ⇒ Chart
Returns a new instance of Chart.
34 35 36 37 38 39 |
# File 'lib/daytona/common/charts.rb', line 34 def initialize(data) @type = data.fetch(:type, nil) @title = data.fetch(:title, nil) @elements = data.fetch(:elements, []) @png = data.fetch(:png, nil) end |
Instance Attribute Details
#elements ⇒ Array<Object> (readonly)
Returns The elements of the chart.
28 29 30 |
# File 'lib/daytona/common/charts.rb', line 28 def elements @elements end |
#png ⇒ String, Nil (readonly)
Returns The PNG representation of the chart encoded in base64.
31 32 33 |
# File 'lib/daytona/common/charts.rb', line 31 def png @png end |
#title ⇒ String, Nil (readonly)
Returns The title of the chart.
25 26 27 |
# File 'lib/daytona/common/charts.rb', line 25 def title @title end |
#type ⇒ String, Nil (readonly)
Returns The type of chart.
22 23 24 |
# File 'lib/daytona/common/charts.rb', line 22 def type @type end |
Instance Method Details
#to_h ⇒ Hash<Symbol, Object>
Returns original metadata.
42 |
# File 'lib/daytona/common/charts.rb', line 42 def to_h = { type:, title:, elements:, png: } |