class Crep::CrashController
Attributes
app_name[R]
build[R]
bundle_identifier[R]
crashes[R]
template_path[R]
total_crashes[R]
version[R]
Public Class Methods
new(bundle_identifier, top, crash_source, show_only_unresolved, template_path)
click to toggle source
# File lib/crep/crash_controller.rb, line 10 def initialize(bundle_identifier, top, crash_source, show_only_unresolved, template_path) @bundle_identifier = bundle_identifier @top = top @crash_source = crash_source @show_only_unresolved = show_only_unresolved @crash_source.configure(bundle_identifier) @app_name = @crash_source.app.name @template_path = template_path end
Public Instance Methods
latest_top_crashes()
click to toggle source
# File lib/crep/crash_controller.rb, line 20 def latest_top_crashes app_source = HockeyAppAppSource.new app_source.configure latest_top_crashes_with_app_source(app_source) end
latest_top_crashes_with_app_source(app_source)
click to toggle source
# File lib/crep/crash_controller.rb, line 26 def latest_top_crashes_with_app_source(app_source) latest_app = app_source.versions_for_bundle_identifier(@bundle_identifier).first top_crashes(latest_app.version, latest_app.build) end
top_crashes(version, build)
click to toggle source
returns list of top crashes for the given build
# File lib/crep/crash_controller.rb, line 32 def top_crashes(version, build) @version = version @build = build @crashes = @crash_source.crashes(@top, version, build, @show_only_unresolved) @total_crashes = @crash_source.crash_count(version: @version, build: @build) report end
Private Instance Methods
crash_percentage(crash:, total_crashes:)
click to toggle source
# File lib/crep/crash_controller.rb, line 47 def crash_percentage(crash:, total_crashes:) crash.occurrences.to_f / total_crashes.to_f * 100.0 end
report()
click to toggle source
# File lib/crep/crash_controller.rb, line 40 def report template = File.read template_path renderer = ERB.new template puts output = renderer.result(binding) output end