Module: Kernel

Defined in:
lib/clive.rb

Instance Method Summary collapse

Instance Method Details

#Clive(*names) ⇒ Clive

The quickest way to grab a few options. This form does not allow arguments or commands! It is meant to be quick and simple.

Examples:


r = Clive(:verbose, [:b, :bare]).run(%w(--verbose))
r.bare     #=> false
r.verbose  #=> true

# The above example is equivalent to
r = Clive.new {
  opt :verbose
  opt :b, :bare
}.run(%w(--verbose))

Parameters:

  • names (#to_sym, Array<#to_sym>)

    List of names to create options for

Returns:

  • (Clive)

    A clive instance setup with the correct options



136
137
138
139
140
141
142
# File 'lib/clive.rb', line 136

def Clive(*names)
  c = Clive::Base.new
  names.each do |o|
    c.option *Array(o).map(&:to_sym)
  end
  c
end