Sha256: 60f6c23b25b51a68b23d46809e35498cabccdac044d4636497abed8d072835ad

Contents?: true

Size: 684 Bytes

Versions: 8

Compression:

Stored size: 684 Bytes

Contents

# encoding: utf-8

module Cliver
  # A Namespace to hold filter procs
  module Filter
    # The identity filter returns its input unchanged.
    IDENTITY = proc { |version| version }

    # Apply to a list of requirements
    # @param requirements [Array<String>]
    # @return [Array<String>]
    def requirements(requirements)
      requirements.map do |requirement|
        req_parts = requirement.split(/\b(?=\d)/, 2)
        version = req_parts.last
        version.replace apply(version)
        req_parts.join
      end
    end

    # Apply to some input
    # @param version [String]
    # @return [String]
    def apply(version)
      to_proc.call(version)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/cliver-0.3.2/lib/cliver/filter.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/cliver-0.3.2/lib/cliver/filter.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/cliver-0.3.2/lib/cliver/filter.rb
cliver-0.3.2 lib/cliver/filter.rb
cliver-0.3.1 lib/cliver/filter.rb
cliver-0.2.2 lib/cliver/filter.rb
cliver-0.2.1 lib/cliver/filter.rb
cliver-0.2.0 lib/cliver/filter.rb