Sha256: 025354909eaf0029fb56b826a07730637ad960fe67980117c439ce4ce3fec133

Contents?: true

Size: 768 Bytes

Versions: 8

Compression:

Stored size: 768 Bytes

Contents

require 'structured_changelog/version_pattern'

class StructuredChangelog
  class Roadmap
    def self.start_with?(line)
      patterns.any? { |pattern| line =~ pattern }
    end

    def self.patterns
      [
        /^## ROADMAP #{VersionPattern}$/,
        /^## ROADMAP/,
        /^## NEXT RELEASE/,
      ]
    end

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

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

    def version
      self.class.patterns.each do |pattern|
        match = contents.match(pattern)

        if match && match.names.include?('version')
          return Gem::Version.new(match[:version])
        end
      end

      Gem::Version.new(nil)
    end

    private

    attr_reader :contents
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
structured_changelog-0.10.2 lib/structured_changelog/roadmap.rb
structured_changelog-0.10.1 lib/structured_changelog/roadmap.rb
structured_changelog-0.10.0 lib/structured_changelog/roadmap.rb
structured_changelog-0.8.3 lib/structured_changelog/roadmap.rb
structured_changelog-0.8.2 lib/structured_changelog/roadmap.rb
structured_changelog-0.8.1 lib/structured_changelog/roadmap.rb
structured_changelog-0.8.0 lib/structured_changelog/roadmap.rb
structured_changelog-0.7.2 lib/structured_changelog/roadmap.rb