Class: PactBroker::Pacts::Selectors
- Inherits:
-
Array
- Object
- Array
- PactBroker::Pacts::Selectors
- Defined in:
- lib/pact_broker/pacts/selectors.rb
Class Method Summary collapse
- .create_for_all_of_each_tag(tag_names) ⇒ Object
- .create_for_latest_of_each_tag(tag_names) ⇒ Object
- .create_for_overall_latest ⇒ Object
Instance Method Summary collapse
- #+(other) ⇒ Object
-
#initialize(*selectors) ⇒ Selectors
constructor
A new instance of Selectors.
- #latest_for_tag?(potential_tag = nil) ⇒ Boolean
- #overall_latest? ⇒ Boolean
- #tag_names_of_selectors_for_all_pacts ⇒ Object
- #tag_names_of_selectors_for_latest_pacts ⇒ Object
Constructor Details
#initialize(*selectors) ⇒ Selectors
Returns a new instance of Selectors.
6 7 8 |
# File 'lib/pact_broker/pacts/selectors.rb', line 6 def initialize *selectors super([*selectors].flatten) end |
Class Method Details
.create_for_all_of_each_tag(tag_names) ⇒ Object
10 11 12 |
# File 'lib/pact_broker/pacts/selectors.rb', line 10 def self.create_for_all_of_each_tag(tag_names) Selectors.new(tag_names.collect{ | tag_name | Selector.all_for_tag(tag_name) }) end |
.create_for_latest_of_each_tag(tag_names) ⇒ Object
14 15 16 |
# File 'lib/pact_broker/pacts/selectors.rb', line 14 def self.create_for_latest_of_each_tag(tag_names) Selectors.new(tag_names.collect{ | tag_name | Selector.latest_for_tag(tag_name) }) end |
.create_for_overall_latest ⇒ Object
18 19 20 |
# File 'lib/pact_broker/pacts/selectors.rb', line 18 def self.create_for_overall_latest Selectors.new([Selector.overall_latest]) end |
Instance Method Details
#+(other) ⇒ Object
22 23 24 |
# File 'lib/pact_broker/pacts/selectors.rb', line 22 def + other Selectors.new(super) end |
#latest_for_tag?(potential_tag = nil) ⇒ Boolean
30 31 32 |
# File 'lib/pact_broker/pacts/selectors.rb', line 30 def latest_for_tag? potential_tag = nil any? { | selector | selector.latest_for_tag?(potential_tag) } end |
#overall_latest? ⇒ Boolean
26 27 28 |
# File 'lib/pact_broker/pacts/selectors.rb', line 26 def overall_latest? any?(&:overall_latest?) end |
#tag_names_of_selectors_for_all_pacts ⇒ Object
34 35 36 |
# File 'lib/pact_broker/pacts/selectors.rb', line 34 def tag_names_of_selectors_for_all_pacts select(&:all_for_tag?).collect(&:tag).uniq end |
#tag_names_of_selectors_for_latest_pacts ⇒ Object
38 39 40 |
# File 'lib/pact_broker/pacts/selectors.rb', line 38 def tag_names_of_selectors_for_latest_pacts select(&:latest_for_tag?).collect(&:tag).uniq end |