Class: Teapot::Command::Selection
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Teapot::Command::Selection
- Defined in:
- lib/teapot/command/selection.rb
Overview
Base class for commands that work with selections.
Direct Known Subclasses
Build, List, Status, Visualize::Files, Visualize::Packages, Visualize::Targets
Instance Method Summary collapse
-
#call ⇒ Object
Execute the selection command.
-
#selection(context) ⇒ Object
Get the selection for the given context.
-
#targets ⇒ Object
The set of target names to process, or nil if no targets were specified.
Instance Method Details
#call ⇒ Object
Execute the selection command.
36 37 38 39 40 |
# File 'lib/teapot/command/selection.rb', line 36 def call context = parent.context self.process(selection(parent.context)) end |
#selection(context) ⇒ Object
Get the selection for the given context.
27 28 29 30 31 32 33 |
# File 'lib/teapot/command/selection.rb', line 27 def selection(context) if targets = self.targets context.select(targets) else context.select(context.configuration[:build]) end end |
#targets ⇒ Object
The set of target names to process, or nil if no targets were specified.
18 19 20 21 22 |
# File 'lib/teapot/command/selection.rb', line 18 def targets if @targets and @targets.any? Set.new(@targets) end end |