Class: Gem::OptionParser::Switch::PlacedArgument

Inherits:
Gem::OptionParser::Switch show all
Defined in:
lib/rubygems/vendor/optparse/lib/optparse.rb

Overview

Switch that takes an argument, which does not begin with ‘-’ or is ‘-’.

Instance Attribute Summary

Attributes inherited from Gem::OptionParser::Switch

#arg, #block, #conv, #desc, #long, #pattern, #short

Instance Method Summary collapse

Methods inherited from Gem::OptionParser::Switch

#add_banner, #compsys, guess, incompatible_argument_styles, #initialize, #match_nonswitch?, pattern, #pretty_print, #pretty_print_contents, #summarize, #switch_name

Constructor Details

This class inherits a constructor from Gem::OptionParser::Switch

Instance Method Details

#parse(arg, argv, &error) ⇒ Object

Returns nil if argument is not present or begins with ‘-’ and is not ‘-’.



775
776
777
778
779
780
781
782
783
784
785
786
787
# File 'lib/rubygems/vendor/optparse/lib/optparse.rb', line 775

def parse(arg, argv, &error)
  if !(val = arg) and (argv.empty? or /\A-./ =~ (val = argv[0]))
    return nil, block, nil
  end
  opt = (val = parse_arg(val, &error))[1]
  val = conv_arg(*val)
  if opt and !arg
    argv.shift
  else
    val[0] = nil
  end
  val
end

#pretty_headObject

:nodoc:



789
790
791
# File 'lib/rubygems/vendor/optparse/lib/optparse.rb', line 789

def pretty_head           # :nodoc:
  "Placed"
end