Class: Songkick::Transport::Reporting::Report
- Inherits:
-
Object
- Object
- Songkick::Transport::Reporting::Report
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/songkick/transport/reporting.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ Report
constructor
A new instance of Report.
-
#to_html(endpoints_to_names) ⇒ Object
endpoints_to_names is a hash like:.
- #total_duration ⇒ Object
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
42 43 44 |
# File 'lib/songkick/transport/reporting.rb', line 42 def initialize @requests = [] end |
Instance Method Details
#execute ⇒ Object
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.("../html_report.html.erb", __FILE__)) template = ERB.new(source) template.result(binding) end |
#total_duration ⇒ Object
53 54 55 |
# File 'lib/songkick/transport/reporting.rb', line 53 def total_duration inject(0) { |s,r| s + r.duration } end |