Class: Trackplot::SparklineBuilder
- Inherits:
-
Object
- Object
- Trackplot::SparklineBuilder
- Defined in:
- lib/trackplot/sparkline_builder.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(data, **options) ⇒ SparklineBuilder
constructor
A new instance of SparklineBuilder.
- #render(view_context) ⇒ Object
Constructor Details
#initialize(data, **options) ⇒ SparklineBuilder
8 9 10 11 |
# File 'lib/trackplot/sparkline_builder.rb', line 8 def initialize(data, **) @data = DataAdapter.normalize(data) = end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/trackplot/sparkline_builder.rb', line 6 def data @data end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/trackplot/sparkline_builder.rb', line 6 def end |
Instance Method Details
#render(view_context) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/trackplot/sparkline_builder.rb', line 13 def render(view_context) config = build_config view_context.content_tag( "trackplot-sparkline", nil, config: config.to_json, style: sparkline_style ) end |