Sha256: 94d620db864fb5032457f3794312db687a6a24e7b283912ecbd384f107a6939d

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

module LogsViewer
  class Handler

    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

    def self.file_open(path)
      File.open(File.expand_path(path,__FILE__),"r").read
    end

    def self.is_file?(path)
      File.file? path
    end

    def self.is_directory?(path)
      File.directory? path
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logs_viewer-0.2.0 lib/logs_viewer/handler.rb
logs_viewer-0.1.0 lib/logs_viewer/handler.rb