Add default options filename as constant

This commit is contained in:
Olle Jonsson 2016-02-23 23:54:20 +01:00
parent 179f110b8a
commit 4e6906dccf

View File

@ -4,20 +4,21 @@ module GitHubChangelogGenerator
ParserError = Class.new(StandardError)
class ParserFile
FILENAME = ".github_changelog_generator"
def initialize(options)
@options = options
end
# Destructively change @options using data in configured options file.
def parse!
return unless file.exist?
file.each_line { |line| parse_line!(line) }
file.each_line { |line| parse_line!(line) } if file.exist?
end
private
def file
@file ||= Pathname(File.expand_path(@options[:params_file] || ".github_changelog_generator"))
@file ||= Pathname(File.expand_path(@options[:params_file] || FILENAME))
end
def parse_line!(line)