Method: Ark::CLI::Argument#initialize
- Defined in:
- lib/ark/cli/argument.rb
#initialize(name, default = nil, variad: false) ⇒ Argument
Initialize a new Argument object. name must be alphanumeric and must begin with a letter. If this argument is unfulfilled, default will be returned as its value, if default is non-nil. If variad is true, then this argument will act as a glob for all trailing args.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ark/cli/argument.rb', line 60 def initialize(name, default=nil, variad: false) unless self.class.valid_name?(name) raise ArgumentSyntaxError, "Invalid argument name: #{name}" end @name = name.to_s @default = default @variad = variad if self.variadic? @value = [] else @value = nil end end |