Class: LogsExplorer::LogsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/logs_explorer/logs_controller.rb

Instance Method Summary collapse

Methods included from ApplicationHelper

#active?, #format_datetime, #icon, #insert_css_file, #insert_js_file

Instance Method Details

#changesObject



11
12
13
14
# File 'app/controllers/logs_explorer/logs_controller.rb', line 11

def changes
  @lines = log_file.readlines
  @total_lines = log_file.total_lines
end

#downloadObject



16
17
18
# File 'app/controllers/logs_explorer/logs_controller.rb', line 16

def download
  send_file log_file.path
end

#log_fileObject



20
21
22
23
24
25
# File 'app/controllers/logs_explorer/logs_controller.rb', line 20

def log_file
  @log_file ||= begin
    item = LogsExplorer.logs.detect {|e| e[:name] == params[:name]}
    LogFile.new(path: item[:path], client_total_lines: params[:client_total_lines])
  end
end

#watchObject



9
# File 'app/controllers/logs_explorer/logs_controller.rb', line 9

def watch; end