Module: AssLauncher::Enterprise::Cli::Parameters Private
- Included in:
- StringParam
- Defined in:
- lib/ass_launcher/enterprise/cli/parameters.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
1C Enterprise cli parameters Fuckin 1C have very obscure cli api Parameters may have subparameters. All parameters and subparameters expects argument or not. Some parameters may be modified with + or - or other values like this: /Parm or /Param+ or /Param- or /Param:date:time.
For implement binding parameters and subparameters, parameter have parent
propery. If parent
property is nil
it is root parameter and subpurameter if else
Defined Under Namespace
Classes: AllParameters, Chose, Flag, ParametersList, Path, PathTwice, Skip, SkippedError, StringParam, Switch
Constant Summary collapse
- DEFAULT_OPTIONS =
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.
Options for parameter
{ required: false, value_validator: nil, switch_list: nil, chose_list: nil, switch_value: nil }.freeze
Instance Attribute Summary collapse
-
#binary_matcher ⇒ BinaryMatcher
readonly
private
1C binary type and version for which parameter defined.
-
#desc ⇒ Object
readonly
private
Parameter help message.
-
#group ⇒ Symbol
readonly
private
Parameter group for build cli api help.
-
#modes ⇒ Array<Symbol>
readonly
private
1C binary run mode for which parameter defined.
-
#name ⇒ Object
readonly
private
Parameter name like it define in 1C cli api Name may start with ‘/’ or ‘-’ key.
-
#options ⇒ Hash
readonly
private
Options see DEFAULT_OPTIONS.
-
#parent ⇒ Object
readonly
private
Parent parameter for subpurameter.
Instance Method Summary collapse
-
#add_child(param) ⇒ Object
private
Add subparameter into #childs array.
-
#child?(expected_parent) ⇒ Boolean
private
Returns
true
if it’s child ofexpected_parent
parameter. -
#childs ⇒ Array
private
Array of subparameters.
-
#chose_list ⇒ Object
private
Wrapper for #options.
-
#deep ⇒ Fixnum
private
Returns deep parameter in hierarchy tree.
-
#full_name ⇒ String
private
Returns parameter full name.
-
#match?(binary_wrapper, run_mode) ⇒ Boolean
private
Return
true
if parameter defined forbinary_wrapper
andrun_mode
. -
#match_version?(version) ⇒ Boolean
private
Return
true
if parameter defined forversion
. -
#parents ⇒ Array
private
Array of parent parameters.
-
#required? ⇒ Boolean
private
Wrapper for #options.
-
#restrict_from(version) ⇒ Object
private
Restricts parameter from
version
and do it recursively for all subparameters from #childs array. -
#root? ⇒ Boolean
private
Returns
true
if haven’t #parent parameter. -
#switch_list ⇒ Object
private
Wrapper for #options.
-
#switch_value ⇒ Object
private
Wrapper for #options.
-
#to_args(value) ⇒ Array<String>
private
Returns self with
value
as 1C:Enterprise CLI argumets array. -
#to_s ⇒ Object
private
:nodoc:.
-
#to_sym ⇒ Object
private
:nodoc:.
-
#usage ⇒ Object
private
Builds usage message.
-
#value_validator ⇒ Object
private
Wrapper for #options.
Instance Attribute Details
#binary_matcher ⇒ BinaryMatcher (readonly)
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.
1C binary type and version for which parameter defined
36 37 38 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 36 def binary_matcher @binary_matcher end |
#desc ⇒ Object (readonly)
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.
Parameter help message
32 33 34 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 32 def desc @desc end |
#group ⇒ Symbol (readonly)
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.
Parameter group for build cli api help
39 40 41 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 39 def group @group end |
#modes ⇒ Array<Symbol> (readonly)
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.
1C binary run mode for which parameter defined. see DEFINED_MODES
43 44 45 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 43 def modes @modes end |
#name ⇒ Object (readonly)
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.
Parameter name like it define in 1C cli api Name may start with ‘/’ or ‘-’ key. Example: /Parameter or -subpurameter
29 30 31 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 29 def name @name end |
#options ⇒ Hash (readonly)
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.
Options see DEFAULT_OPTIONS
49 50 51 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 49 def @options end |
#parent ⇒ Object (readonly)
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.
Parent parameter for subpurameter
46 47 48 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 46 def parent @parent end |
Instance Method Details
#add_child(param) ⇒ 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.
Add subparameter into #childs array
184 185 186 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 184 def add_child(param) childs << param end |
#child?(expected_parent) ⇒ Boolean
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 true
if it’s child of expected_parent
parameter
99 100 101 102 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 99 def child?(expected_parent) return false if root? parent == expected_parent end |
#childs ⇒ 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.
Array of subparameters
178 179 180 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 178 def childs @childs ||= [] end |
#chose_list ⇒ 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.
Wrapper for #options
124 125 126 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 124 def chose_list [:chose_list] end |
#deep ⇒ Fixnum
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 deep parameter in hierarchy tree
88 89 90 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 88 def deep parents.size end |
#full_name ⇒ String
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 parameter full name. Full name composed from full_name
of all #parents parameters
74 75 76 77 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 74 def full_name return name if root? "#{parent.full_name}#{name}" end |
#match?(binary_wrapper, run_mode) ⇒ Boolean
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.
Return true
if parameter defined for binary_wrapper
and run_mode
55 56 57 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 55 def match?(binary_wrapper, run_mode) binary_matcher.match?(binary_wrapper) && modes.include?(run_mode) end |
#match_version?(version) ⇒ Boolean
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.
Return true
if parameter defined for version
61 62 63 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 61 def match_version?(version) binary_matcher.requirement.satisfied_by? version end |
#parents ⇒ 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.
Array of parent parameters
81 82 83 84 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 81 def parents return [] if root? parent.parents << parent end |
#required? ⇒ Boolean
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.
Wrapper for #options
139 140 141 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 139 def required? [:required] end |
#restrict_from(version) ⇒ 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.
Restricts parameter from version
and do it recursively for all subparameters from #childs array
191 192 193 194 195 196 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 191 def restrict_from(version) restrict_childs(version) binary_matcher.requirement = restrict_v(binary_matcher.requirement, version) if match_version? version end |
#root? ⇒ Boolean
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 true
if haven’t #parent parameter
93 94 95 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 93 def root? parent.nil? end |
#switch_list ⇒ 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.
Wrapper for #options
119 120 121 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 119 def switch_list [:switch_list] end |
#switch_value ⇒ 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.
Wrapper for #options
134 135 136 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 134 def switch_value [:switch_value] || proc { |value| value } end |
#to_args(value) ⇒ Array<String>
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 self with value
as 1C:Enterprise CLI argumets array
114 115 116 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 114 def to_args(value) [key(value).to_s, value(value).to_s] end |
#to_s ⇒ 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.
:nodoc:
105 106 107 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 105 def to_s name.to_s end |
#to_sym ⇒ 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.
:nodoc:
66 67 68 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 66 def to_sym name.downcase.to_sym end |
#usage ⇒ 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.
Builds usage message
165 166 167 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 165 def usage fail NotImplementedError end |
#value_validator ⇒ 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.
Wrapper for #options
129 130 131 |
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 129 def value_validator [:value_validator] || proc { |value| value } end |