Class: Kettle::Family::Selection
- Inherits:
-
Object
- Object
- Kettle::Family::Selection
- Defined in:
- lib/kettle/family/selection.rb
Constant Summary collapse
- STATUS_TOKEN_KEYS =
{ "unreleased" => "unreleased_entries", "prepared" => "prepared_release_pending", "pending" => "pending_release" }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #apply(only: nil, exclude: nil, start_at: nil) ⇒ Object
-
#initialize(members:, release_state_results: nil) ⇒ Selection
constructor
A new instance of Selection.
Constructor Details
#initialize(members:, release_state_results: nil) ⇒ Selection
Returns a new instance of Selection.
20 21 22 23 |
# File 'lib/kettle/family/selection.rb', line 20 def initialize(members:, release_state_results: nil) @members = members @release_state_results = release_state_results end |
Class Method Details
.status_token?(value) ⇒ Boolean
16 17 18 |
# File 'lib/kettle/family/selection.rb', line 16 def self.status_token?(value) STATUS_TOKEN_KEYS.key?(value.to_s) end |
.status_tokens ⇒ Object
12 13 14 |
# File 'lib/kettle/family/selection.rb', line 12 def self.status_tokens STATUS_TOKEN_KEYS.keys end |
Instance Method Details
#apply(only: nil, exclude: nil, start_at: nil) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/kettle/family/selection.rb', line 25 def apply(only: nil, exclude: nil, start_at: nil) selected = members selected = select_only(selected, only) if only selected = select_exclude(selected, exclude) if exclude selected = select_start_at(selected, start_at) if start_at raise Error, "selection is empty" if selected.empty? selected end |