Class: Lyra::Visualization::TimelineHtmlBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/lyra/visualization/timeline.rb

Overview

HTML builder for timeline visualization (replaces Phlex dependency)

Instance Method Summary collapse

Constructor Details

#initialize(events) ⇒ TimelineHtmlBuilder

Returns a new instance of TimelineHtmlBuilder.



229
230
231
# File 'lib/lyra/visualization/timeline.rb', line 229

def initialize(events)
  @events = events.sort_by { |e| event_timestamp(e) }
end

Instance Method Details

#buildObject



233
234
235
236
237
238
239
240
241
# File 'lib/lyra/visualization/timeline.rb', line 233

def build
  html = []
  html << '<div class="lyra-timeline">'
  html << "<style>#{timeline_styles}</style>"
  html << build_header
  html << build_body
  html << '</div>'
  html.join("\n")
end