class OptimistXL::ShortNames
Attributes
auto[R]
chars[R]
Public Class Methods
new()
click to toggle source
# File lib/optimist_xl.rb, line 829 def initialize @chars = [] @auto = true end
Public Instance Methods
add(values)
click to toggle source
# File lib/optimist_xl.rb, line 836 def add(values) values = [values] unless values.is_a?(Array) # box the value values.compact.each do |val| if val == :none @auto = false raise "Cannot set short to :none if short-chars have been defined '#{@chars}'" unless chars.empty? next end strval = val.to_s sopt = case strval when /^-(.)$/ then $1 when /^.$/ then strval else raise ArgumentError, "invalid short option name '#{val.inspect}'" end if sopt =~ INVALID_ARG_REGEX raise ArgumentError, "short option name '#{sopt}' can't be a number or a dash" end @chars << sopt end end