Module: AssLauncher::Cmd::Abstract::Option::Raw Private

Included in:
Run, Main::SubCommands::Web::SubCommands::Uri
Defined in:
lib/ass_launcher/cmd.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.

Mixin Command option

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ 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.



405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/ass_launcher/cmd.rb', line 405

def self.included(base)
  description = "other 1C CLI parameters in raw(native) format.\n"\
    'Parameters and their arguments must be delimited'\
    " comma-space sequence: `, '\n"\
    "If values includes comma comma must be slashed `\\\\,'\n"\
    'WARNING: correctness of parsing will not guaranteed!'

  base.option '--raw', '"/Par VAL, -SubPar VAL"', description,
              multivalued: true do |s|
    parse_raw s
  end
end

Instance Method Details

#parse_raw(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.



386
387
388
389
390
391
392
393
394
395
# File 'lib/ass_launcher/cmd.rb', line 386

def parse_raw(s)
  split = s.split(%r{(?<!\\),\s}).map(&:strip)

  split.map do |pv|
    fail ArgumentError, "Parse error in: #{pv}" unless\
      pv =~ %r{^(/|-)}
    pv =~ %r{^(\/|-)([^\s]+)+(.*)?}
    ["#{$1}#{$2}", $3.strip].map { |i| i.gsub('\\,', ',') }
  end
end

#raw_paramObject

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.



397
398
399
400
401
402
403
# File 'lib/ass_launcher/cmd.rb', line 397

def raw_param
  r = []
  raw_list.each do |params|
    r += params
  end
  r
end