Sha256: 3a37ae0a9085873048e61e91ddc9864187d01f16e4e2b26fdeb42feae0eaee68

Contents?: true

Size: 1.34 KB

Versions: 15

Compression:

Stored size: 1.34 KB

Contents

require 'pact_broker/hash_refinements'

module PactBroker
  module Matrix
    class UnresolvedSelector < Hash
      using PactBroker::HashRefinements

      def initialize(params = {})
        merge!(params)
      end

      def self.from_hash(hash)
        new(hash.symbolize_keys.snakecase_keys.slice(:pacticipant_name, :pacticipant_version_number, :latest, :tag, :max_age))
      end

      def pacticipant_name
        self[:pacticipant_name]
      end

      def pacticipant_version_number
        self[:pacticipant_version_number]
      end

      def latest?
        !!latest
      end

      def overall_latest?
        latest? && !tag && !max_age
      end

      def latest
        self[:latest]
      end

      def tag
        self[:tag]
      end

      def latest= latest
        self[:latest] = latest
      end

      def tag= tag
        self[:tag] = tag
      end

      def pacticipant_name= pacticipant_name
        self[:pacticipant_name] = pacticipant_name
      end

      def pacticipant_version_number= pacticipant_version_number
        self[:pacticipant_version_number] = pacticipant_version_number
      end

      def max_age= max_age
        self[:max_age] = max_age
      end

      def max_age
        self[:max_age]
      end

      def latest_for_pacticipant_and_tag?
        !!(pacticipant_name && tag && latest)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.79.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.78.1 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.78.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.77.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.76.2 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.76.1 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.76.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.75.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.74.1 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.74.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.73.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.72.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.71.0 lib/pact_broker/matrix/unresolved_selector.rb
pact_broker-2.70.0 lib/pact_broker/matrix/unresolved_selector.rb