Class: Scripted::Running::SelectCommands
- Inherits:
-
Object
- Object
- Scripted::Running::SelectCommands
- Defined in:
- lib/scripted/running/select_commands.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #commands(group_names) ⇒ Object
-
#initialize(configuration, logger) ⇒ SelectCommands
constructor
A new instance of SelectCommands.
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
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/scripted/running/select_commands.rb', line 7 def configuration @configuration end |
#logger ⇒ Object (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 |