Module: Threshold::Standalone

Included in:
EventFilter, RateFilter, Suppression
Defined in:
lib/threshold/standalone.rb

Instance Method Summary collapse

Instance Method Details

#<=>(anOther) ⇒ Object

Comparable



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/threshold/standalone.rb', line 41

def <=>(anOther)
  #gid <=> anOther.gid
  c = self.class.to_s <=> anOther.class.to_s
  if c == 0 then
    d = self.gid <=> anOther.gid
    if d == 0 then
      self.sid <=> anOther.sid
    else
      return d
    end
  else
    return c
  end
end

#==(an0ther) ⇒ Object Also known as: eql?

Equality Methods



18
19
20
# File 'lib/threshold/standalone.rb', line 18

def ==(an0ther)
  an0ther.class == self.class && an0ther.hash == hash
end

#comment?(skip) ⇒ Boolean

Handle Comment Skipping

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/threshold/standalone.rb', line 5

def comment?(skip)
  if skip
    return false
  else
    if defined?(@comment)
      return true
    else
      return false
    end
  end
end

#hashObject



24
25
26
# File 'lib/threshold/standalone.rb', line 24

def hash
  state.hash
end

#include?(an0ther) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/threshold/standalone.rb', line 28

def include?(an0ther)
  return false unless an0ther.class == self.class

  state.zip(an0ther.state).each{ |item|
    if !(item[1].nil?)
      return false unless item[0] == item[1]
    end
  }

  return true
end