Sha256: 77b9ada6321e8482366e9811d744e6a5fc097a3f3b9c4ea831b75d7c3f6e5d33

Contents?: true

Size: 1.03 KB

Versions: 34

Compression:

Stored size: 1.03 KB

Contents

require "pact_broker/pacts/selector"
require "pact_broker/hash_refinements"

module PactBroker
  module Versions
    class Selector < PactBroker::Pacts::Selector
      def resolve_for_branch(consumer_version, resolved_branch_name)
        # Need to rename branch to branch_name
        ResolvedSelector.new(self.to_h.merge({ resolved_branch_name: resolved_branch_name }.compact), consumer_version)
      end
    end

    class ResolvedSelector < PactBroker::Pacts::ResolvedSelector
      using PactBroker::HashRefinements

      PROPERTY_NAMES = PactBroker::Pacts::Selector::PROPERTY_NAMES + [:version, :resolved_branch_name]

      def initialize(properties = {}, version)
        properties.without(*PROPERTY_NAMES).tap { |it| warn("WARN: Unsupported property for #{self.class.name}: #{it.keys.join(", ")} at #{caller[0..3]}") if it.any? }
        merge!(properties.merge(version: version))
      end

      def resolved_branch_name
        self[:resolved_branch_name]
      end

      def version
        self[:version]
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact_broker/versions/selector.rb
pact_broker-2.111.0 lib/pact_broker/versions/selector.rb
pact_broker-2.109.1 lib/pact_broker/versions/selector.rb
pact_broker-2.109.0 lib/pact_broker/versions/selector.rb
pact_broker-2.108.0 lib/pact_broker/versions/selector.rb
pact_broker-2.107.1 lib/pact_broker/versions/selector.rb
pact_broker-2.107.0 lib/pact_broker/versions/selector.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/versions/selector.rb
pact_broker-2.106.0 lib/pact_broker/versions/selector.rb
pact_broker-2.105.0 lib/pact_broker/versions/selector.rb
pact_broker-2.104.0 lib/pact_broker/versions/selector.rb
pact_broker-2.103.0 lib/pact_broker/versions/selector.rb
pact_broker-2.102.2 lib/pact_broker/versions/selector.rb
pact_broker-2.102.1 lib/pact_broker/versions/selector.rb
pact_broker-2.102.0 lib/pact_broker/versions/selector.rb
pact_broker-2.101.0 lib/pact_broker/versions/selector.rb
pact_broker-2.100.0 lib/pact_broker/versions/selector.rb
pact_broker-2.99.0 lib/pact_broker/versions/selector.rb
pact_broker-2.98.0 lib/pact_broker/versions/selector.rb
pact_broker-2.97.0 lib/pact_broker/versions/selector.rb