class LogsViewer::Handler

Public Class Methods

file_open(path) click to toggle source
# File lib/logs_viewer/handler.rb, line 12
def self.file_open(path)
  File.open(File.expand_path(path,__FILE__),"r").read
end
is_directory?(path) click to toggle source
# File lib/logs_viewer/handler.rb, line 20
def self.is_directory?(path)
  File.directory? path
end
is_file?(path) click to toggle source
# File lib/logs_viewer/handler.rb, line 16
def self.is_file?(path)
  File.file? path
end
list(dir, type: nil ) click to toggle source
# File lib/logs_viewer/handler.rb, line 4
def self.list(dir, type: nil )
  case type
    when :file then Dir[File.join(dir, '**')].reject {|f| File.directory?(f)}
    when :directory then Dir[File.join(dir, '**')].select {|f| File.directory?(f)}
    else Dir[File.join(dir, '**')]
  end
end