Class: Threshold::RateFilter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Standalone

#<=>, #comment?

Constructor Details

#initialize(line = "") ⇒ RateFilter

Returns a new instance of RateFilter.



106
107
108
# File 'lib/threshold/rate_filter.rb', line 106

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

Instance Attribute Details

#apply_toObject

Returns the value of attribute apply_to.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def apply_to
  @apply_to
end

#commentObject

Returns the value of attribute comment.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def comment
  @comment
end

#countObject

Returns the value of attribute count.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def count
  @count
end

#gidObject

Returns the value of attribute gid.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def gid
  @gid
end

#new_actionObject

Returns the value of attribute new_action.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def new_action
  @new_action
end

#secondsObject

Returns the value of attribute seconds.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def seconds
  @seconds
end

#sidObject

Returns the value of attribute sid.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def sid
  @sid
end

#timeoutObject

Returns the value of attribute timeout.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def timeout
  @timeout
end

#track_byObject

Returns the value of attribute track_by.



100
101
102
# File 'lib/threshold/rate_filter.rb', line 100

def track_by
  @track_by
end

Instance Method Details

#to_s(skip = false) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/threshold/rate_filter.rb', line 110

def to_s(skip = false)

   if self.valid? 
      if apply_to == nil then
        if comment?(skip)
         "rate_filter gen_id #{@gid}, sig_id #{@sid}, track by_#{@track_by}, count #{@count}, seconds #{@seconds}, new_action #{@new_action}, timeout #{@timeout} #{@comment}"
        else
         "rate_filter gen_id #{@gid}, sig_id #{@sid}, track by_#{@track_by}, count #{@count}, seconds #{@seconds}, new_action #{@new_action}, timeout #{@timeout}"
        end  
      else
        if comment?(skip)
         "rate_filter gen_id #{@gid}, sig_id #{@sid}, count #{@count}, seconds #{@seconds}, new_action #{@new_action}, timeout #{@timeout} apply_to #{@apply_to} #{@comment}"
        else
         "rate_filter gen_id #{@gid}, sig_id #{@sid}, count #{@count}, seconds #{@seconds}, new_action #{@new_action}, timeout #{@timeout} apply_to #{@apply_to}"
        end 
      end 
   else
     raise InvalidRateFilterObject, 'Rate Filter did not validate'
   end
end