Class: Songkick::Transport::Reporting::Report

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/songkick/transport/reporting.rb

Instance Method Summary collapse

Constructor Details

#initializeReport

Returns a new instance of Report.



42
43
44
# File 'lib/songkick/transport/reporting.rb', line 42

def initialize
  @requests = []
end

Instance Method Details

#executeObject



46
47
48
49
50
51
# File 'lib/songkick/transport/reporting.rb', line 46

def execute
  Thread.current[:songkick_transport_report] = self
  yield
ensure
  Thread.current[:songkick_transport_report] = nil
end

#to_html(endpoints_to_names) ⇒ Object

endpoints_to_names is a hash like:

{"dc1-live-service1:9324" => "media-service"}


60
61
62
63
64
# File 'lib/songkick/transport/reporting.rb', line 60

def to_html(endpoints_to_names)
  source = File.read(File.expand_path("../html_report.html.erb", __FILE__))
  template = ERB.new(source)
  template.result(binding)
end

#total_durationObject



53
54
55
# File 'lib/songkick/transport/reporting.rb', line 53

def total_duration
  inject(0) { |s,r| s + r.duration }
end