Class: GitHubChangelogGenerator::ParserFile

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

Overview

ParserFile is a configuration file reader which sets options in the given Hash.

In your project’s root, you can put a file named .github_changelog_generator to override defaults.

Example:

header_label=# My Super Changelog
; Comments are allowed
future-release=5.0.0
# Ruby-style comments, too
since-tag=1.0.0

The configuration format is some-key=value or some_key=value.

Instance Method Summary collapse

Constructor Details

#initialize(options, io = nil) ⇒ ParserFile

Returns a new instance of ParserFile.

Parameters:

  • options (Hash)

    options to be configured from file contents

  • io (nil, IO) (defaults to: nil)

    configuration file handle



48
49
50
51
# File 'lib/github_changelog_generator/parser_file.rb', line 48

def initialize(options, io = nil)
  @options = options
  @io = io
end

Instance Method Details

#parse!Object

Sets options using configuration file content



54
55
56
57
58
59
# File 'lib/github_changelog_generator/parser_file.rb', line 54

def parse!
  return unless @io

  @io.each_with_index { |line, i| parse_line!(line, i + 1) }
  @io.close
end