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) ParserError = Class.new(StandardError)
class ParserFile class ParserFile
FILENAME = ".github_changelog_generator"
def initialize(options) def initialize(options)
@options = options @options = options
end end
# Destructively change @options using data in configured options file.
def parse! def parse!
return unless file.exist? file.each_line { |line| parse_line!(line) } if file.exist?
file.each_line { |line| parse_line!(line) }
end end
private private
def file def file
@file ||= Pathname(File.expand_path(@options[:params_file] || ".github_changelog_generator")) @file ||= Pathname(File.expand_path(@options[:params_file] || FILENAME))
end end
def parse_line!(line) def parse_line!(line)