metafiles: extract constant arrays

This commit is contained in:
Jack Nagel 2014-06-07 17:45:13 -05:00
parent 6524dfc17b
commit e2c79aaea4

View File

@ -1,11 +1,9 @@
class Metafiles class Metafiles
EXTENSIONS = %w[.md .html .rtf .txt]
def initialize BASENAMES = %w[
@exts = %w[.md .html .rtf .txt] about authors changelog changes copying copyright history license licence
@metafiles = %w[ news notes notice readme todo
about authors changelog changes copying copyright history license ]
licence news notes notice readme todo]
end
def + other def + other
@metafiles + other @metafiles + other
@ -27,11 +25,11 @@ class Metafiles
ext = File.extname(path) ext = File.extname(path)
if EXTENSIONS.include?(ext) if EXTENSIONS.include?(ext)
file = File.basename(path, ext) basename = File.basename(path, ext)
else else
file = File.basename(path) basename = File.basename(path)
end end
return @metafiles.include?(file) return BASENAMES.include?(basename)
end end
end end