Class: Moodwall::Optparse

Inherits:
Object
  • Object
show all
Defined in:
lib/moodwall/optparse.rb

Defined Under Namespace

Classes: ScriptOptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = ScriptOptions.new) ⇒ Optparse

Returns a new instance of Optparse.



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

def initialize(options = ScriptOptions.new)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/moodwall/optparse.rb', line 5

def options
  @options
end

#parserObject (readonly)

Returns the value of attribute parser.



5
6
7
# File 'lib/moodwall/optparse.rb', line 5

def parser
  @parser
end

Instance Method Details

#parse(args) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/moodwall/optparse.rb', line 11

def parse(args)
  @args = OptionParser.new do |parser|
    options.define_options(parser)
    parser.parse!(args)
  end
  options
end