Class: Parselogs::Parse

Inherits:
Object
  • Object
show all
Defined in:
lib/parselogs/track.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Parse

Returns a new instance of Parse.



7
8
9
# File 'lib/parselogs/track.rb', line 7

def initialize(options)
  @options = options
end

Instance Method Details

#search(folder) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/parselogs/track.rb', line 11

def search(folder)
  file_ops = Parselogs::FileOps.new()
  files = Dir.glob(folder)
  files.each do |file|
    file = file_ops.get_file_with_date(file)
    if file_ops.file_in_range?(file[:date], @options[:days].to_i)
      puts "Parsing : #{file[:name]}"
      if file_ops.logfile?(file[:name])
        file_ops.parse_file(file[:name],@options[:search])
      elsif file_ops.compressed?(file[:name])
        file_ops.parse_compressed_file(file[:name],@options[:search])
      end
    end
  end
end