Class: EvJobGen::CLI::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/ev_job_gen/cli/option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOption

Returns a new instance of Option.



8
9
10
11
12
# File 'lib/ev_job_gen/cli/option.rb', line 8

def initialize
  @jobfile = nil
  @target  = "cronjob"
  @config  = nil
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/ev_job_gen/cli/option.rb', line 6

def config
  @config
end

#jobfileObject (readonly)

Returns the value of attribute jobfile.



6
7
8
# File 'lib/ev_job_gen/cli/option.rb', line 6

def jobfile
  @jobfile
end

#targetObject (readonly)

Returns the value of attribute target.



6
7
8
# File 'lib/ev_job_gen/cli/option.rb', line 6

def target
  @target
end

Instance Method Details

#parse!(argv) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/ev_job_gen/cli/option.rb', line 14

def parse!(argv)
  opt = OptionParser.new
  opt.on('--jobfile jobfile') { |v| @jobfile = v }
  opt.on('--target [target]') { |v| @target = v }
  opt.on('--config [config]') { |v| @config = v }
  opt.parse!(argv)
  validate!
end