Class: MapEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/filters/cidrtagmap.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec = "") ⇒ MapEntry

Returns a new instance of MapEntry.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/logstash/filters/cidrtagmap.rb', line 9

def initialize(spec = "")
	begin
		parts = spec.split(',',2)
		@range = IPAddr.new(parts[0])
		@tag = parts[1].split(',')
		return self
	rescue
		@logger.warn("cidrtagmap: error parsing map entry #{spec}")
		return nil
	end
end

Instance Attribute Details

#rangeObject (readonly)

Returns the value of attribute range.



8
9
10
# File 'lib/logstash/filters/cidrtagmap.rb', line 8

def range
  @range
end

#tagObject (readonly)

Returns the value of attribute tag.



8
9
10
# File 'lib/logstash/filters/cidrtagmap.rb', line 8

def tag
  @tag
end

Instance Method Details

#includesAddress?(ipaddr) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/logstash/filters/cidrtagmap.rb', line 21

def includesAddress?(ipaddr)
	return @range.include?(ipaddr)
end