Module: OptionParser::Defaults

Defined in:
lib/optparse/defaults.rb

Defined Under Namespace

Modules: Arguments

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Instance Method Details

#defaults=(defaults) ⇒ Object



7
8
9
# File 'lib/optparse/defaults.rb', line 7

def defaults=(defaults)
  @defaults = defaults.extend(Arguments)
end

#helpObject



20
21
22
# File 'lib/optparse/defaults.rb', line 20

def help
  @defaults.help(super, summary_indent)
end

#order(*args, &block) ⇒ Object

Note that it’s important to use #order rather than #permute, to ensure that the given options have a chance to override the defaults. (These are POSIX-ly correct semantics.)



14
15
16
17
18
# File 'lib/optparse/defaults.rb', line 14

def order(*args, &block)
  super(*@defaults.followed_by(*args), &block)
rescue ParseError
  abort($!)
end