Class: Kettle::Family::Selection
- Inherits:
-
Object
- Object
- Kettle::Family::Selection
- Defined in:
- lib/kettle/family/selection.rb
Instance Method Summary collapse
- #apply(only: nil, start_at: nil) ⇒ Object
-
#initialize(members:) ⇒ Selection
constructor
A new instance of Selection.
Constructor Details
#initialize(members:) ⇒ Selection
Returns a new instance of Selection.
6 7 8 |
# File 'lib/kettle/family/selection.rb', line 6 def initialize(members:) @members = members end |
Instance Method Details
#apply(only: nil, start_at: nil) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/kettle/family/selection.rb', line 10 def apply(only: nil, start_at: nil) selected = members selected = select_only(selected, only) if only selected = select_start_at(selected, start_at) if start_at raise Error, "selection is empty" if selected.empty? selected end |