Sha256: 1c8501bef121d9bbe779567088259db763db13127b4d8853ab184240553d55e9

Contents?: true

Size: 456 Bytes

Versions: 1

Compression:

Stored size: 456 Bytes

Contents

require 'treetop'
require 'grammar.tt'

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

1 entries across 1 versions & 1 rubygems

Version Path
parse_a_changelog-0.2.3 lib/parse_a_changelog.rb