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

TODO rename branch to branch_name



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

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)


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

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

#branchObject



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

def branch
  self[:branch]
end

#branch=(branch) ⇒ Object



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

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

#environment_nameObject



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

def environment_name
  self[:environment_name]
end

#environment_name=(environment_name) ⇒ Object



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

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

#latestObject



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

def latest
  self[:latest]
end

#latest=(latest) ⇒ Object



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

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

#latest?Boolean

Returns:

  • (Boolean)


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

def latest?
  !!latest
end

#latest_for_pacticipant_and_tag?Boolean

Returns:

  • (Boolean)


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

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

#max_ageObject



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

def max_age
  self[:max_age]
end

#max_age=(max_age) ⇒ Object

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



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

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

#overall_latest?Boolean

Returns:

  • (Boolean)


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

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

#pacticipant_nameObject



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

def pacticipant_name
  self[:pacticipant_name]
end

#pacticipant_name=(pacticipant_name) ⇒ Object



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

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

#pacticipant_version_numberObject



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

def pacticipant_version_number
  self[:pacticipant_version_number]
end

#pacticipant_version_number=(pacticipant_version_number) ⇒ Object



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

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

#tagObject



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

def tag
  self[:tag]
end

#tag=(tag) ⇒ Object



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

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