Class: HeatmapBuilder::LinearHeatmapBuilder

Inherits:
Builder
  • Object
show all
Includes:
ValueConversion
Defined in:
lib/heatmap_builder/linear_heatmap_builder.rb

Constant Summary

Constants inherited from Builder

Builder::BLUE_OCEAN, Builder::DEFAULT_OPTIONS, Builder::GITHUB_GREEN, Builder::PURPLE_VIBES, Builder::RED_TO_GREEN, Builder::WARM_SUNSET

Instance Method Summary collapse

Methods inherited from Builder

#initialize

Constructor Details

This class inherits a constructor from HeatmapBuilder::Builder

Instance Method Details

#buildObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/heatmap_builder/linear_heatmap_builder.rb', line 8

def build
  svg_content = computed_scores.map.with_index do |score, index|
    cell_svg(score, index)
  end.join

  svg_container(
    width: computed_scores.length * options[:cell_size] + (computed_scores.length - 1) * options[:cell_spacing],
    height: options[:cell_size]
  ) { svg_content }
end