Sha256: 7c777da96448a64616a469a355a7f04a0a8a93b39176c8d13c6b2f4770b290fc

Contents?: true

Size: 453 Bytes

Versions: 4

Compression:

Stored size: 453 Bytes

Contents

require 'treetop'
require 'grammar'

module ParseAChangelog
  class ParseError < StandardError; end

  class << self
    def parse(file_path)
      file = File.read(file_path)
      parser = KeepAChangelogParser.new
      result = parser.parse(file)

      if !result
        raise ParseError.new(failure_message(parser))
      end

      result
    end

    def failure_message(parser)
      parser.failure_reason.split(' after ')[0]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parse_a_changelog-1.0.2 lib/parse_a_changelog.rb
parse_a_changelog-1.0.1 lib/parse_a_changelog.rb
parse_a_changelog-1.0.0 lib/parse_a_changelog.rb
parse_a_changelog-0.2.2 lib/parse_a_changelog.rb