Class: GetoptLong

Inherits:
Object show all
Defined in:
lib/standard/facets/getoptlong.rb

Overview

GetoptLong

Ruby's standard GetoptLong class with an added DSL.

opts = GetoptLong.new do
  reqs '--expect', '-x'
  flag '--help', '-h'
end

See GetoptLong::DSL for details.

Defined Under Namespace

Classes: DSL

Instance Method Summary collapse

Constructor Details

#initialize(*arguments, &block) ⇒ GetoptLong

Returns a new instance of GetoptLong.


19
20
21
22
23
24
25
# File 'lib/standard/facets/getoptlong.rb', line 19

def initialize(*arguments, &block)
  if block_given?
    raise ArgumentError unless arguments.empty?
    arguments = DSL.new(&block).arguments
  end
  init(*arguments)
end

Instance Method Details

#initObject


16
# File 'lib/standard/facets/getoptlong.rb', line 16

alias :init :initialize