Method: V::Arguments::Slot#initialize

Defined in:
lib/v/arguments.rb

#initialize(argument, defaults, options) ⇒ Slot

Returns a new instance of Slot.



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/v/arguments.rb', line 70

def initialize(argument, defaults, options)
  @to_s, @to_sym = "#{ argument }".gsub('_', '-'), argument
  @captures = [argument]
  @options = options
  @standalone, @defaults = defaults.empty?, defaults.map { |d| d.to_s }

  @fstring = if @options[:rude] then '%s'
      elsif @options[:alias] and @standalone then '-$op'
      elsif @options[:alias] and not @standalone then '-$op %s'
      elsif not @options[:alias] and @standalone then '--$op'
      else '--$op=%s'
      end
end