Sha256: 232e234cbc544fa6ba7653a0a3aa9902556ccb786aa340280c5ae21bb7384cba

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

module ActiveRecordProfiler
  module ReportsHelper
    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

    def bar_value(sort, item)
      return 0 unless item && sort
      if sort == ActiveRecordProfiler::Collector::AVG_DURATION
        item[Collector::DURATION] / item[Collector::COUNT]
      else
        item[sort]
      end
    end

    def breakable_path(path)
      h(path).gsub('/', "​/")
    end

    def location_description(path, line_number)
      "#{breakable_path(path)}: #{h(line_number)}".html_safe
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active-record-profiler-1.2.1 app/helpers/active_record_profiler/reports_helper.rb
active-record-profiler-1.2.0 app/helpers/active_record_profiler/reports_helper.rb
active-record-profiler-1.1.0 app/helpers/active_record_profiler/reports_helper.rb
active-record-profiler-1.0 app/helpers/active_record_profiler/reports_helper.rb