lib/fig/command/options/parser.rb
def make_switch_array(arguments, block)
    # This method is a means of interjecting ourselves between the creation of
    # a Switch object and putting it into the list of actual switches.
    #
    # From the OptionParser code, the contents of the array:
    #
    # +switch+::      OptionParser::Switch instance to be inserted.
    # +short_opts+::  List of short style options.
    # +long_opts+::   List of long style options.
    # +nolong_opts+:: List of long style options with "no-" prefix.
    #
    # Why returning this data separate from the Switch object is necessary, I
    # do not understand.

    switch_array = @parser.make_switch(arguments, block)
    switch = switch_array[0]

    options = [switch.long, switch.short].flatten

    return if options.any? {|option| @switches.has_key? option}

    options.each {|option| @switches[option] = switch}

    return switch_array
  end
# This class knows way too much about how OptionParser works.
This class knows way too much about how OptionParser works.
This class knows way too much about how OptionParser works .
def make_switch_array(arguments, block)
     From the OptionParser code, the contents of the array:
     +switch+::      OptionParser::Switch instance to be inserted.
     +short_opts+::  List of short style options.
     +long_opts+::   List of long style options.
     +nolong_opts+:: List of long style options with "no-" prefix.
     Why returning this data separate from the Switch object is necessary, I
     do not understand.
    switch_array = @parser.make_switch(arguments, block)
    switch = switch_array[0]
    options = [switch.long, switch.short].flatten
    return if options.any? {|option| @switches.has_key? option}
    options.each {|option| @switches[option] = switch}
    return switch_array
  end
def make_switch_array ( arguments , block ) switch_array = @parser . make_switch ( arguments , block ) switch = switch_array [ 0 ] options = [ switch . long , switch . short ] . flatten return if options . any? { | option | @switches . has_key? option } options . each { | option | @switches [ option ] = switch } return switch_array end
This class knows way too much about how OptionParser works.
This class knows way too much about how OptionParser works .
# This method is a means of interjecting ourselves between the creation of # a Switch object and putting it into the list of actual switches. # # From the OptionParser code, the contents of the array: # # +switch+::      OptionParser::Switch instance to be inserted. # +short_opts+::  List of short style options. # +long_opts+::   List of long style options. # +nolong_opts+:: List of long style options with "no-" prefix. # # Why returning this data separate from the Switch object is necessary, I # do not understand.
arguments
block