Class: Trackplot::Component
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Trackplot::Component
- Defined in:
- lib/trackplot/component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(data:, **options, &block) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(data:, **options, &block) ⇒ Component
Returns a new instance of Component.
10 11 12 13 |
# File 'lib/trackplot/component.rb', line 10 def initialize(data:, **, &block) @builder = ChartBuilder.new(data, **) @block = block end |
Instance Method Details
#call ⇒ Object
15 16 17 18 |
# File 'lib/trackplot/component.rb', line 15 def call @block&.call(@builder) @builder.render(self) end |