Class: MapEntry
- Inherits:
-
Object
- Object
- MapEntry
- Defined in:
- lib/logstash/filters/cidrtagmap.rb
Instance Attribute Summary collapse
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #includesAddress?(ipaddr) ⇒ Boolean
-
#initialize(spec = "") ⇒ MapEntry
constructor
A new instance of MapEntry.
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
#range ⇒ Object (readonly)
Returns the value of attribute range.
8 9 10 |
# File 'lib/logstash/filters/cidrtagmap.rb', line 8 def range @range end |
#tag ⇒ Object (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
21 22 23 |
# File 'lib/logstash/filters/cidrtagmap.rb', line 21 def includesAddress?(ipaddr) return @range.include?(ipaddr) end |