Module: DRbQS::Command::Argument
- Included in:
- Base, Setting::Manage, Setting::SSH
- Defined in:
- lib/drbqs/command_line/argument.rb
Class Method Summary collapse
Class Method Details
.check_argument_size(argv, *args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/drbqs/command_line/argument.rb', line 13 def check_argument_size(argv, *args) n = argv.size args.each_slice(2).each do |ary| if ary.size == 2 unless n.__send__(*ary) raise ArgumentError, "Invalid arguments number. Please refer to documents." end else raise ArgumentError, "Invalid argument to check array size." end end true end |
.split_arguments(argv, split = '--') ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/drbqs/command_line/argument.rb', line 4 def split_arguments(argv, split = '--') if n = argv.index(split) [argv[0..(n - 1)], argv[(n + 1)..-1]] else [argv, []] end end |