Method: GetoptLong#each

Defined in:
lib/getoptlong.rb

#eachObject Also known as: each_option

Iterator version of ‘get’.

The block is called repeatedly with two arguments: The first is the option name. The second is the argument which followed it (if any). Example: (‘–opt’, ‘value’)

The option name is always converted to the first (preferred) name given in the original options to GetoptLong.new.



600
601
602
603
604
605
606
# File 'lib/getoptlong.rb', line 600

def each
  loop do
    option_name, option_argument = get_option
    break if option_name == nil
    yield option_name, option_argument
  end
end