Class: Threshold::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/threshold/builder.rb

Overview

Returns an Array of Grok Captures from the input file matching Threshold Conf standards

Instance Method Summary collapse

Constructor Details

#initialize(parsed_data) ⇒ Builder

Returns a new instance of Builder.



5
6
7
8
# File 'lib/threshold/builder.rb', line 5

def initialize(parsed_data)
  @parsed_data = parsed_data
  @parsed_data.reject! {|k,v| v.compact.first == nil }
end

Instance Method Details

#buildObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/threshold/builder.rb', line 10

def build
   #Strip out NIL Stuctures
	if @parsed_data.key?("SUPPRESSION")
		return Threshold::Suppression.new(@parsed_data)
	elsif @parsed_data.key?("RATEFILTER")
		return Threshold::RateFilter.new(@parsed_data)
	else @parsed_data.key?("EVENTFILTER")
		return Threshold::EventFilter.new(@parsed_data)
	end
end