Class: LogsViewer::Handler
- Inherits:
-
Object
- Object
- LogsViewer::Handler
- Defined in:
- lib/logs_viewer/handler.rb
Class Method Summary collapse
- .file_open(path) ⇒ Object
- .is_directory?(path) ⇒ Boolean
- .is_file?(path) ⇒ Boolean
- .list(dir, type: nil) ⇒ Object
Class Method Details
.file_open(path) ⇒ Object
12 13 14 |
# File 'lib/logs_viewer/handler.rb', line 12 def self.file_open(path) File.open(File.(path,__FILE__),"r").read end |
.is_directory?(path) ⇒ Boolean
20 21 22 |
# File 'lib/logs_viewer/handler.rb', line 20 def self.is_directory?(path) File.directory? path end |
.is_file?(path) ⇒ Boolean
16 17 18 |
# File 'lib/logs_viewer/handler.rb', line 16 def self.is_file?(path) File.file? path end |
.list(dir, type: nil) ⇒ Object
4 5 6 7 8 9 10 |
# 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 |