Method: Indy#initialize

Defined in:
lib/indy/indy.rb

#initialize(args) ⇒ Indy

Initialize Indy. Also see class method Indy#search.

Examples:


Indy.new(:source => LOG_CONTENTS_STRING)
Indy.new(:source => {:cmd => LOG_COMMAND_STRING})
Indy.new(:entry_regexp => LOG_REGEX_PATTERN, :entry_fields => [:time,:application,:message], :source => LOG_FILE)
Indy.new(:time_format => '%m-%d-%Y', :entry_regexp => LOG_REGEX_PATTERN, :entry_fields => [:time,:application,:message], :source => LOG_FILE)

Raises:

  • (ArgumentError)


16
17
18
19
20
21
22
23
# File 'lib/indy/indy.rb', line 16

def initialize(args)
  params = args.dup
  raise ArgumentError, "Source parameter not specified" unless (params.respond_to?(:keys) && params.keys.include?(:source))
  source_param = params[:source]
  params.delete :source
  @search = Search.new()
  @search.source = Source.new( source_param, LogDefinition.new(params) )
end