Class: GitHubChangelogGenerator::FileParserChooser

Inherits:
Object
  • Object
show all
Defined in:
lib/github_changelog_generator/parser_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ FileParserChooser

Returns a new instance of FileParserChooser.



9
10
11
12
# File 'lib/github_changelog_generator/parser_file.rb', line 9

def initialize(options)
  @options     = options
  @config_file = Pathname.new(options[:config_file])
end

Instance Method Details

#parse!(_argv) ⇒ Object



14
15
16
17
18
# File 'lib/github_changelog_generator/parser_file.rb', line 14

def parse!(_argv)
  return nil unless (path = resolve_path)

  ParserFile.new(@options, File.open(path)).parse!
end

#resolve_pathObject



20
21
22
23
24
25
26
27
# File 'lib/github_changelog_generator/parser_file.rb', line 20

def resolve_path
  return @config_file if @config_file.exist?

  path = @config_file.expand_path
  return path if File.exist?(path)

  nil
end