Class: S7::S7Cli::ArrayOption

Inherits:
Option
  • Object
show all
Defined in:
lib/s7/s7cli/option.rb

Instance Method Summary collapse

Methods inherited from Option

#arg_name, #initialize, #opt_name

Methods included from GetText

#N_, #_, bindtextdomain, included

Constructor Details

This class inherits a constructor from S7::S7Cli::Option

Instance Method Details

#define(opts, config) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/s7/s7cli/option.rb', line 85

def define(opts, config)
  define_args = []
  if @short_name
    define_args << ("-" + @short_name)
  end
  s = arg_name[0, 1]
  args = ("1".."3").collect { |i| s + i.to_s }.join(",")
  define_args << ("--" + opt_name + "=" + args)
  define_args << Array
  define_args << @description
  opts.define(*define_args) do |arg|
    config[@name] = arg
  end
end