Sha256: 0dda94a71cc4adc37ab901112afeb5ce42bf7ff2c893a8e32986a90ce2d4aaa6

Contents?: true

Size: 657 Bytes

Versions: 11

Compression:

Stored size: 657 Bytes

Contents

require 'structured_changelog/version_pattern'

class StructuredChangelog
  class Release
    attr_reader :contents

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

    def self.pattern
      /^## RELEASE #{VersionPattern}$/
    end

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

    def validate
      notifications = []

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

      notifications
    end

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

      Gem::Version.new(version_string)
    end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
structured_changelog-0.11.2 lib/structured_changelog/release.rb
structured_changelog-0.11.1 lib/structured_changelog/release.rb
structured_changelog-0.11.0 lib/structured_changelog/release.rb
structured_changelog-0.10.2 lib/structured_changelog/release.rb
structured_changelog-0.10.1 lib/structured_changelog/release.rb
structured_changelog-0.10.0 lib/structured_changelog/release.rb
structured_changelog-0.8.3 lib/structured_changelog/release.rb
structured_changelog-0.8.2 lib/structured_changelog/release.rb
structured_changelog-0.8.1 lib/structured_changelog/release.rb
structured_changelog-0.8.0 lib/structured_changelog/release.rb
structured_changelog-0.7.2 lib/structured_changelog/release.rb