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.



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

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.



368
369
370
371
372
373
374
375
376
377
# File 'lib/ass_launcher/cmd.rb', line 368

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.



379
380
381
382
383
384
385
# File 'lib/ass_launcher/cmd.rb', line 379

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