Class: PactBroker::Matrix::UnresolvedSelector

Inherits:
Hash
  • Object
show all
Defined in:
lib/pact_broker/matrix/unresolved_selector.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ UnresolvedSelector

Returns a new instance of UnresolvedSelector.



8
9
10
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 8

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

Class Method Details

.from_hash(hash) ⇒ Object



12
13
14
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 12

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

Instance Method Details

#all_for_pacticipant?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 81

def all_for_pacticipant?
  !!pacticipant_name && !pacticipant_version_number && !tag && !branch && !latest && !environment_name && !max_age
end

#branchObject



40
41
42
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 40

def branch
  self[:branch]
end

#branch=(branch) ⇒ Object



56
57
58
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 56

def branch= branch
  self[:branch] = branch
end

#environment_nameObject



44
45
46
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 44

def environment_name
  self[:environment_name]
end

#environment_name=(environment_name) ⇒ Object



60
61
62
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 60

def environment_name= environment_name
  self[:environment_name] = environment_name
end

#latestObject



32
33
34
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 32

def latest
  self[:latest]
end

#latest=(latest) ⇒ Object



48
49
50
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 48

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

#latest?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 24

def latest?
  !!latest
end

#latest_for_pacticipant_and_tag?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 85

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

#max_ageObject



77
78
79
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 77

def max_age
  self[:max_age]
end

#max_age=(max_age) ⇒ Object

TODO delete this once docker image uses new selector class for clean



73
74
75
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 73

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

#overall_latest?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 28

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

#pacticipant_nameObject



16
17
18
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 16

def pacticipant_name
  self[:pacticipant_name]
end

#pacticipant_name=(pacticipant_name) ⇒ Object



64
65
66
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 64

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

#pacticipant_version_numberObject



20
21
22
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 20

def pacticipant_version_number
  self[:pacticipant_version_number]
end

#pacticipant_version_number=(pacticipant_version_number) ⇒ Object



68
69
70
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 68

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

#tagObject



36
37
38
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 36

def tag
  self[:tag]
end

#tag=(tag) ⇒ Object



52
53
54
# File 'lib/pact_broker/matrix/unresolved_selector.rb', line 52

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