Class: Lite::Command::Sequence
- Inherits:
-
Base
- Object
- Base
- Lite::Command::Sequence
show all
- Defined in:
- lib/lite/command/sequence.rb
Instance Attribute Summary
Attributes inherited from Base
#context
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
inherited, #initialize
Class Method Details
.step(*commands, **options) ⇒ Object
7
8
9
10
11
|
# File 'lib/lite/command/sequence.rb', line 7
def self.step(*commands, **options)
commands.flatten.each do |command|
steps << Step.new(command, options)
end
end
|
.steps ⇒ Object
13
14
15
|
# File 'lib/lite/command/sequence.rb', line 13
def self.steps
@steps ||= []
end
|
Instance Method Details
#call ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/lite/command/sequence.rb', line 17
def call
self.class.steps.each do |step|
next unless step.run?(self)
cmd = step.command.call(context)
throw!(cmd) if cmd.bad?
end
end
|