Class: Scripted::Running::SelectCommands

Inherits:
Object
  • Object
show all
Defined in:
lib/scripted/running/select_commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, logger) ⇒ SelectCommands

Returns a new instance of SelectCommands.



9
10
11
12
# File 'lib/scripted/running/select_commands.rb', line 9

def initialize(configuration, logger)
  @configuration = configuration
  @logger = logger
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



7
8
9
# File 'lib/scripted/running/select_commands.rb', line 7

def configuration
  @configuration
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/scripted/running/select_commands.rb', line 7

def logger
  @logger
end

Instance Method Details

#commands(group_names) ⇒ Object



14
15
16
17
18
# File 'lib/scripted/running/select_commands.rb', line 14

def commands(group_names)
  group_names = [:default] if group_names.empty?
  groups = configuration.groups.values_at(*group_names.map(&:to_sym))
  groups.map { |group| group.commands }.flatten.map { |command| RunCommand.new(command, logger) }
end