Class: Avm::Launcher::Instances::RunnerHelper
- Inherits:
-
Object
- Object
- Avm::Launcher::Instances::RunnerHelper
show all
- Defined in:
- lib/avm/launcher/instances/runner_helper.rb
Instance Method Summary
collapse
Instance Method Details
9
10
11
|
# File 'lib/avm/launcher/instances/runner_helper.rb', line 9
def context
@context ||= ::Avm::Launcher::Context.current
end
|
#find_instances(instance_name) ⇒ Object
13
14
15
|
# File 'lib/avm/launcher/instances/runner_helper.rb', line 13
def find_instances(instance_name)
context.instances.select { |instance| instance_match?(instance, instance_name) }
end
|
#instance_label(instance) ⇒ Object
35
36
37
|
# File 'lib/avm/launcher/instances/runner_helper.rb', line 35
def instance_label(instance)
"#{instance.name} [#{instance_stereotypes(instance)}]"
end
|
#instance_match?(instance, instance_name) ⇒ Boolean
17
18
19
|
# File 'lib/avm/launcher/instances/runner_helper.rb', line 17
def instance_match?(instance, instance_name)
::File.fnmatch?(instance_name, instance.name)
end
|
#instance_stereotypes(instance) ⇒ Object
31
32
33
|
# File 'lib/avm/launcher/instances/runner_helper.rb', line 31
def instance_stereotypes(instance)
instance.stereotypes.map(&:label).join(', ')
end
|
#instances ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/avm/launcher/instances/runner_helper.rb', line 21
def instances
if parsed.all?
context.instances
elsif parsed.pending?
context.pending_instances
else
parsed.instance_path.flat_map { |p| find_instances(p) }
end
end
|