class Snort::RuleOption

Attributes

arguments[R]
keyword[R]

Public Class Methods

new(keyword, arguments=nil) click to toggle source

@param [String] keyword @param [String] arguments

# File lib/snort/rule/option.rb, line 8
def initialize(keyword, arguments=nil)
  @keyword = keyword.to_s
  if arguments == nil
    @arguments = []
  elsif arguments.class == String or arguments.class == Fixnum
    @arguments = [arguments]
  elsif arguments.class == Array
    @arguments = arguments
  else
    raise "I don't know what to do with an argument of class #{arguments.class}"
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/snort/rule/option.rb, line 30
def ==(other)
  @keyword == other.keyword && @arguments == other.arguments
end
add_argument(argument) click to toggle source
# File lib/snort/rule/option.rb, line 21
def add_argument(argument)
  @arguments << argument
end
eql?(other) click to toggle source
# File lib/snort/rule/option.rb, line 34
def eql?(other)
  self == other
end
hash() click to toggle source
# File lib/snort/rule/option.rb, line 38
def hash
  [@keyword, @arguments].hash
end
to_s() click to toggle source
# File lib/snort/rule/option.rb, line 25
def to_s
  return "#{@keyword};" if @arguments.length == 0
  "#{@keyword}:#{@arguments.join("; ")};"
end