Class: Doubleshot::CLI::Options

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/doubleshot/cli/options.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Options

Returns a new instance of Options.

Yields:

  • (_self)

Yield Parameters:



20
21
22
23
24
# File 'lib/doubleshot/cli/options.rb', line 20

def initialize
  super
  @parser = OptionParser.new
  yield self
end

Class Method Details

.__forward__(*methods) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/doubleshot/cli/options.rb', line 8

def self.__forward__(*methods)
  methods.each do |method|
    define_method(method) do |*args, &b|
      @parser.send(method, *args, &b)
    end
  end
end

Instance Method Details

#parse!(args) ⇒ Object



26
27
28
29
# File 'lib/doubleshot/cli/options.rb', line 26

def parse!(args)
  self.args = @parser.parse! args
  self
end

#to_sObject



31
32
33
# File 'lib/doubleshot/cli/options.rb', line 31

def to_s
  @parser.to_s
end