Module: Rails::Pretty::Logger::DashboardsHelper

Defined in:
app/helpers/rails/pretty/logger/dashboards_helper.rb

Instance Method Summary collapse

Instance Method Details

#check_highlight(line) ⇒ Object



3
4
5
6
# File 'app/helpers/rails/pretty/logger/dashboards_helper.rb', line 3

def check_highlight(line)
  return "<div class='highlight'>#{line.remove('[HIGHLIGHT]')}</div>".html_safe if line.include?("[HIGHLIGHT]")
  line
end

#check_rails_versionObject



34
35
36
# File 'app/helpers/rails/pretty/logger/dashboards_helper.rb', line 34

def check_rails_version
  Rails::VERSION::STRING[0..2].to_f < 5.2
end

#is_file_active(name, params) ⇒ Object



26
27
28
# File 'app/helpers/rails/pretty/logger/dashboards_helper.rb', line 26

def is_file_active(name, params)
  "active" if params[:log_file] == name
end

#is_page_active(index, params) ⇒ Object



30
31
32
# File 'app/helpers/rails/pretty/logger/dashboards_helper.rb', line 30

def is_page_active(index, params)
  "active" if params[:page].to_i == index
end

#is_stdout?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/helpers/rails/pretty/logger/dashboards_helper.rb', line 12

def is_stdout?
  ENV["RAILS_LOG_TO_STDOUT"].present?
end

#set_divider(params) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'app/helpers/rails/pretty/logger/dashboards_helper.rb', line 16

def set_divider(params)
  if params[:date_range].blank?
    100
  elsif params[:date_range][:divider].blank?
    100
  else
    params[:date_range][:divider]
  end
end

#time_nowObject



8
9
10
# File 'app/helpers/rails/pretty/logger/dashboards_helper.rb', line 8

def time_now
  Time.now.strftime("%Y-%m-%d")
end