class PactBroker::Pacts::ResolvedSelector

Constants

PROPERTY_NAMES

Public Class Methods

new(properties = {}, consumer_version) click to toggle source
# File lib/pact_broker/pacts/selector.rb, line 378
def initialize(properties = {}, consumer_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(consumer_version: consumer_version))
end

Public Instance Methods

<=>(other) click to toggle source
Calls superclass method PactBroker::Pacts::Selector#<=>
# File lib/pact_broker/pacts/selector.rb, line 395
def <=> other
  comparison = super
  if comparison == 0
    consumer_version.order <=> other.consumer_version.order
  else
    comparison
  end
end
==(other) click to toggle source
Calls superclass method PactBroker::Pacts::Selector#==
# File lib/pact_broker/pacts/selector.rb, line 391
def == other
  super && consumer_version == other.consumer_version
end
consumer_version() click to toggle source
# File lib/pact_broker/pacts/selector.rb, line 383
def consumer_version
  self[:consumer_version]
end
currently_deployed_comparison(other) click to toggle source
# File lib/pact_broker/pacts/selector.rb, line 404
def currently_deployed_comparison(other)
  if currently_deployed? == other.currently_deployed?
    production_comparison(other)
  else
    currently_deployed? ? -1 : 1
  end

end
currently_supported_comparison(other) click to toggle source
# File lib/pact_broker/pacts/selector.rb, line 413
def currently_supported_comparison(other)
  if currently_supported? == other.currently_supported?
    production_comparison(other)
  else
    currently_supported? ? -1 : 1
  end
end
environment() click to toggle source
# File lib/pact_broker/pacts/selector.rb, line 387
def environment
  self[:environment]
end
production_comparison(other) click to toggle source
# File lib/pact_broker/pacts/selector.rb, line 421
def production_comparison(other)
  if environment.production? == other.environment.production?
    environment.name <=> other.environment.name
  else
    environment.production? ? 1 : -1
  end
end