Sha256: fe395b0a88d5d6bebdc271993c840870031dba7ed6d5f6bcd5bb4878db2bf08e

Contents?: true

Size: 694 Bytes

Versions: 11

Compression:

Stored size: 694 Bytes

Contents

require 'structured_changelog/release_filters/base'
require 'structured_changelog/version_pattern'

class StructuredChangelog
  module ReleaseFilters
    class MatchesVersionsBetween < Base
      def self.pattern
        /^(?<floor>#{VersionPattern})\ \<\ (?<ceiling>#{VersionPattern})$/
      end

      def filter_releases(releases)
        releases.select do |release|
          Gem::Version.new(floor) <= release.version &&
            release.version <= Gem::Version.new(ceiling)
        end
      end

      private

      def floor
        query.match(self.class.pattern)[:floor]
      end

      def ceiling
        query.match(self.class.pattern)[:ceiling]
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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