Class: Terraspace::Compiler::Select
- Inherits:
-
Object
- Object
- Terraspace::Compiler::Select
- Includes:
- App::CallableOption::Concern, Util::Logging
- Defined in:
- lib/terraspace/compiler/select.rb
Instance Method Summary collapse
- #exclude_stacks ⇒ Object
- #include_stacks ⇒ Object
-
#initialize(stack_name) ⇒ Select
constructor
A new instance of Select.
- #selected? ⇒ Boolean
Methods included from Util::Logging
Methods included from App::CallableOption::Concern
Constructor Details
#initialize(stack_name) ⇒ Select
Returns a new instance of Select.
6 7 8 |
# File 'lib/terraspace/compiler/select.rb', line 6 def initialize(stack_name) @stack_name = stack_name end |
Instance Method Details
#exclude_stacks ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/terraspace/compiler/select.rb', line 41 def exclude_stacks if config.all.exclude_stacks config_name = "config.all.exclude_stacks" config_value = config.dig(:all, :exclude_stacks) elsif config.all.consider_allow_deny_stacks config_name = "config.deny.stacks" config_value = config.dig(:deny, :stacks) else return end callable_option( config_name: config_name, config_value: config_value, passed_args: [@stack_name], ) end |
#include_stacks ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/terraspace/compiler/select.rb', line 24 def include_stacks if config.all.include_stacks config_name = "config.all.include_stacks" config_value = config.dig(:all, :include_stacks) elsif config.all.consider_allow_deny_stacks config_name = "config.allow.stacks" config_value = config.dig(:allow, :stacks) else return end callable_option( config_name: config_name, config_value: config_value, passed_args: [@stack_name], ) end |
#selected? ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/terraspace/compiler/select.rb', line 10 def selected? ignore_stacks_deprecation_warning if include_stacks.nil? && exclude_stacks.nil? true elsif include_stacks.nil? !exclude_stacks.include?(@stack_name) elsif exclude_stacks.nil? include_stacks.include?(@stack_name) else stacks = include_stacks - exclude_stacks stacks.include?(@stack_name) end end |