Sha256: 6687227c6149542976a950db9b92b4e855e85a26334f06970533bb54ab59d913

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 Bytes

Contents

class StructuredChangelog
  class Release
    attr_reader :contents

    def self.start_with?(line)
      line =~ pattern
    end

    def self.pattern
      /^## RELEASE (?<version>\d+\.\d+\.\d+\S*)$/
    end

    def initialize(contents)
      @contents = contents.strip
    end

    def validate
      notifications = []

      notifications << "No version number" if version.nil?

      notifications
    end

    def version
      contents.match(self.class.pattern)[:version]
    end

    def <=>(release)
      version <=> release.version
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
structured_changelog-0.7.0 lib/structured_changelog/release.rb
structured_changelog-0.6.2 lib/structured_changelog/release.rb
structured_changelog-0.6.1 lib/structured_changelog/release.rb