Sha256: 801f361c071ebd3ba275bc4f7d0570bab945511717e62bb0ace80652de77e426

Contents?: true

Size: 565 Bytes

Versions: 3

Compression:

Stored size: 565 Bytes

Contents

# frozen_string_literal: true

require "pathname"

module GitHubChangelogGenerator
  class FileParserChooser
    def initialize(options)
      @options = options
      @config_file = Pathname.new(options[:config_file])
    end

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

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

    def resolve_path
      return @config_file if @config_file.exist?

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

      nil
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
px_github_changelog_generator-0.0.2 lib/github_changelog_generator/file_parser_chooser.rb
px_github_changelog_generator-0.0.1 lib/github_changelog_generator/file_parser_chooser.rb
px_github_changelog_generator-0.0.0 lib/github_changelog_generator/file_parser_chooser.rb