Class: AssLauncher::Enterprise::Cli::Parameters::Switch Private

Inherits:
StringParam
  • Object
show all
Defined in:
lib/ass_launcher/enterprise/cli/parameters.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.

Switch parameter is most stupid CLI parameter of 1C:Enterprise. Switch parameter expects argument value from :switch_list or block :switch_value which return modified value argument. Switch parameter modifyed self name when uses parameter value

Examples:

# /UseHwLicenses have {:+=>'',:-=>''} switch_list and:
 to_args(:+) # => ['/UseHwLicenses+','']
 to_args(:-) # => ['/UseHwLicenses-','']
 to_args(:bad_value) # => ArgumentError

# -TimeLimit have block:
 {switch_value: ->(value) { ":#{value}"}}
# and
 to_args("12:00") # => ['-TimeLimit:12:00','']

Constant Summary

Constants included from AssLauncher::Enterprise::Cli::Parameters

DEFAULT_OPTIONS

Instance Attribute Summary

Attributes included from AssLauncher::Enterprise::Cli::Parameters

#binary_matcher, #desc, #group, #modes, #name, #options, #parent

Instance Method Summary collapse

Methods inherited from StringParam

#argument_require, #arguments_count, #initialize

Methods included from AssLauncher::Enterprise::Cli::Parameters

#add_child, #child?, #childs, #chose_list, #deep, #full_name, #match?, #match_version?, #parents, #required?, #restrict_from, #root?, #switch_list, #switch_value, #to_args, #to_s, #to_sym, #usage, #value_validator

Constructor Details

This class inherits a constructor from AssLauncher::Enterprise::Cli::Parameters::StringParam

Instance Method Details

#valid?(value) ⇒ 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:

  • (Boolean)


403
404
405
406
# File 'lib/ass_launcher/enterprise/cli/parameters.rb', line 403

def valid?(value)
  switch_list.keys.map(&:to_s).map(&:downcase).include?\
    value.to_s.downcase
end