Class: Spoom::Coverage::D3::Timeline::Sigs

Inherits:
Stacked show all
Extended by:
T::Sig
Defined in:
lib/spoom/coverage/d3/timeline.rb

Instance Attribute Summary

Attributes inherited from Base

#id

Instance Method Summary collapse

Methods inherited from Stacked

#line, #plot, #script

Methods inherited from Spoom::Coverage::D3::Timeline

#area, header_script, header_style, #line, #plot, #points, #script, #x_scale, #x_ticks, #y_scale, #y_ticks

Methods inherited from Base

header_script, header_style, #html, #script

Constructor Details

#initialize(id, snapshots) ⇒ Sigs

Returns a new instance of Sigs.



475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/spoom/coverage/d3/timeline.rb', line 475

def initialize(id, snapshots)
  keys = ['false', 'true']
  data = snapshots.map do |snapshot|
    {
      timestamp: snapshot.commit_timestamp,
      commit: snapshot.commit_sha,
      total: snapshot.methods_with_sig + snapshot.methods_without_sig,
      values: { true: snapshot.methods_with_sig, false: snapshot.methods_without_sig },
    }
  end
  super(id, data, keys)
end

Instance Method Details

#tooltipObject



489
490
491
492
493
494
495
# File 'lib/spoom/coverage/d3/timeline.rb', line 489

def tooltip
  <<~JS
    function tooltip_#{id}(d) {
      tooltipTimeline(d, "methods");
    }
  JS
end