Class: MultipleMan::Options

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/multiple_man/cli.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Options

Returns a new instance of Options.



13
14
15
16
# File 'lib/multiple_man/cli.rb', line 13

def initialize(*args)
  @options = { mode: :general, environment_path: 'config/environment' }
  super
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



11
12
13
# File 'lib/multiple_man/cli.rb', line 11

def options
  @options
end

Class Method Details

.parse!(args) ⇒ Object



5
6
7
8
9
# File 'lib/multiple_man/cli.rb', line 5

def self.parse!(args)
  parser = new('Multiple Man')
  parser.set_opts.parse!(args)
  parser.options
end

Instance Method Details

#set_optsObject



18
19
20
21
22
23
24
25
# File 'lib/multiple_man/cli.rb', line 18

def set_opts
  on('--seed', 'listen to the seeding queue') do
    options[:mode] = :seed
  end
  on('-e', '--environment-path PATH', 'Set the path to load the web framework (default: config/environment)') do |value|
    options[:environment_path] = value
  end
end