Class: Teapot::Command::Selection

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/teapot/command/selection.rb

Overview

Base class for commands that work with selections.

Instance Method Summary collapse

Instance Method Details

#callObject

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

#targetsObject

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