lib/nagios_parser/object/parser.rb in nagios_parser-1.1.0 vs lib/nagios_parser/object/parser.rb in nagios_parser-1.2.0
- old
+ new
@@ -44,10 +44,11 @@
when (!last_is_key?(result) and match = scanner.scan(/\w+/))
result << [:KEY, match.chomp.gsub(/\s+$/, '')]
when (inside and match = scanner.scan(/\d+$/))
result << [:VALUE, match.to_i]
when (inside and match = scanner.scan(/[^\n\}]+/))
- result << [:VALUE, match.gsub(/\s+$/, '')]
+ # Make sure to ignore inline comments starting with ';'.
+ result << [:VALUE, match.split(';').first.gsub(/\s+$/, '')]
else
raise "Can't tokenize <#{scanner.peek(10)}>"
end
end