Module: ActiveRecordProfiler::ReportsHelper
- Included in:
- ReportsController
- Defined in:
- app/helpers/active_record_profiler/reports_helper.rb
Instance Method Summary collapse
- #bar_value(sort, item) ⇒ Object
- #breakable_path(path) ⇒ Object
- #location_description(path, line_number) ⇒ Object
- #report_column_header_link(column_id, sort_by, label, page_params) ⇒ Object
Instance Method Details
#bar_value(sort, item) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/helpers/active_record_profiler/reports_helper.rb', line 10 def (sort, item) return 0 unless item && sort if sort == ActiveRecordProfiler::Collector::AVG_DURATION item[Collector::DURATION] / item[Collector::COUNT] else item[sort] end end |
#breakable_path(path) ⇒ Object
19 20 21 |
# File 'app/helpers/active_record_profiler/reports_helper.rb', line 19 def breakable_path(path) h(path).gsub('/', "​/") end |
#location_description(path, line_number) ⇒ Object
23 24 25 |
# File 'app/helpers/active_record_profiler/reports_helper.rb', line 23 def location_description(path, line_number) "#{breakable_path(path)}: #{h(line_number)}".html_safe end |
#report_column_header_link(column_id, sort_by, label, page_params) ⇒ Object
3 4 5 6 7 8 |
# File 'app/helpers/active_record_profiler/reports_helper.rb', line 3 def report_column_header_link(column_id, sort_by, label, page_params) link_to_unless(sort_by == column_id, label, page_params.merge(:sort => column_id) ) end |