Class: AssLauncher::Enterprise::Cli::ArgumentsBuilder Private
- Inherits:
-
Object
- Object
- AssLauncher::Enterprise::Cli::ArgumentsBuilder
- Defined in:
- lib/ass_launcher/enterprise/cli/arguments_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides DSL for build arguments for run 1C:Enterprise clients.
DSL dynamically generated based on CLI specifications CliSpec For each CLI parameter is assigned a DSL method called like a parameter but whitout parameter key such as TOP_LEVEL_PARAM_KEY or NESTED_LEVEL_PARAM_KEY. DSL methods may be prefixed _
char for escape uppercase name of method. DSL method _SomeParameter
and someParameter
equal and assigned for /SomParameter
or -SomeParameter
CLI parameter. DLS methods case insensitive. Top level builder have method IncludeConnectionString#connection_string for pass connection string and convert connection string into arguments array.
Defined Under Namespace
Modules: IncludeConnectionString Classes: BuildError
Constant Summary collapse
- METHOD_TO_PARAM_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/^_/i
- TOP_LEVEL_PARAM_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/'
- NESTED_LEVEL_PARAM_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'-'
Class Method Summary collapse
-
.build_args(binary_wrapper, run_mode, &block) ⇒ Array
private
Arguments for run 1C:Enterprise client.
Instance Method Summary collapse
-
#build_args(&block) ⇒ Object
private
Evaluate &block return array of arguments.
-
#initialize(cli_spec, run_mode, parent_parameter = nil) ⇒ ArgumentsBuilder
constructor
private
A new instance of ArgumentsBuilder.
- #method_missing(method, *args, &block) ⇒ Object private
Constructor Details
#initialize(cli_spec, run_mode, parent_parameter = nil) ⇒ ArgumentsBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ArgumentsBuilder.
99 100 101 102 103 104 105 |
# File 'lib/ass_launcher/enterprise/cli/arguments_builder.rb', line 99 def initialize(cli_spec, run_mode, parent_parameter = nil) @builded_args = [] @cli_spec = cli_spec @parent_parameter = parent_parameter @params_stack = [] @run_mode = run_mode end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
135 136 137 138 139 140 141 142 |
# File 'lib/ass_launcher/enterprise/cli/arguments_builder.rb', line 135 def method_missing(method, *args, &block) param = param_find(method) fail_no_parameter_error(method) unless param fail_if_parameter_exist(param) add_args(param.to_args(*param_argument_get(param, args))) self.builded_args += nested_builder(param).build_args(&block)\ if block_given? end |
Class Method Details
.build_args(binary_wrapper, run_mode, &block) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns arguments for run 1C:Enterprise client.
88 89 90 |
# File 'lib/ass_launcher/enterprise/cli/arguments_builder.rb', line 88 def self.build_args(binary_wrapper, run_mode, &block) new(binary_wrapper.cli_spec, run_mode).build_args(&block) end |
Instance Method Details
#build_args(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluate &block return array of arguments
119 120 121 122 123 124 125 |
# File 'lib/ass_launcher/enterprise/cli/arguments_builder.rb', line 119 def build_args(&block) fail ArgumentError, 'Block require' unless block_given? extend IncludeConnectionString\ if (parent_parameter.nil? && run_mode != :webclient) instance_eval(&block) builded_args end |