Class: Threshold::EventFilter

Inherits:
Object
  • Object
show all
Includes:
Comparable, Standalone
Defined in:
lib/threshold/event_filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Standalone

#<=>, #==, #comment?, #hash, #include?

Constructor Details

#initialize(line = "") ⇒ EventFilter

Returns a new instance of EventFilter.



75
76
77
# File 'lib/threshold/event_filter.rb', line 75

def initialize(line="")
  transform(line) unless line.empty?
end

Instance Attribute Details

#commentObject

Returns the value of attribute comment.



69
70
71
# File 'lib/threshold/event_filter.rb', line 69

def comment
  @comment
end

#countObject

Returns the value of attribute count.



69
70
71
# File 'lib/threshold/event_filter.rb', line 69

def count
  @count
end

#gidObject

Returns the value of attribute gid.



69
70
71
# File 'lib/threshold/event_filter.rb', line 69

def gid
  @gid
end

#secondsObject

Returns the value of attribute seconds.



69
70
71
# File 'lib/threshold/event_filter.rb', line 69

def seconds
  @seconds
end

#sidObject

Returns the value of attribute sid.



69
70
71
# File 'lib/threshold/event_filter.rb', line 69

def sid
  @sid
end

#track_byObject

Returns the value of attribute track_by.



69
70
71
# File 'lib/threshold/event_filter.rb', line 69

def track_by
  @track_by
end

#typeObject

Returns the value of attribute type.



69
70
71
# File 'lib/threshold/event_filter.rb', line 69

def type
  @type
end

Instance Method Details

#stateObject



91
92
93
# File 'lib/threshold/event_filter.rb', line 91

def state
  [@gid, @sid, @type, @track_by, @count, @seconds]
end

#to_s(skip = false) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/threshold/event_filter.rb', line 79

def to_s(skip = false)
  if self.valid?
    if comment?(skip)
      "event_filter gen_id #{@gid}, sig_id #{@sid}, type #{@type}, track by_#{@track_by}, count #{@count}, seconds #{@seconds} #{@comment}"
    else
      "event_filter gen_id #{@gid}, sig_id #{@sid}, type #{@type}, track by_#{@track_by}, count #{@count}, seconds #{@seconds}"
    end
  else
    raise InvalidEventFilterObject, 'Event Filter did not validate'
  end
end