Fixes "double-definition of constants" warning

Looks like `#constants.include?` doesn't work as well as
`#const_defined?`.
This commit is contained in:
Patrick J Cherry
2016-10-05 09:29:07 +01:00
parent 218c55fb63
commit d3762162db

View File

@@ -32,7 +32,7 @@ module FlexNBD
txt_lines.each do |line|
if line =~ /^#\s*define\s+([A-Z0-9_]+)\s+(\d+)\s*$/
# Bodge until I can figure out what to do with #ifdefs
const_set($1, $2.to_i) unless constants.include?( $1 )
const_set($1, $2.to_i) unless const_defined?( $1 )
end
end
end