Class: EvJobGen::CLI::Option
- Inherits:
-
Object
- Object
- EvJobGen::CLI::Option
- Defined in:
- lib/ev_job_gen/cli/option.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#jobfile ⇒ Object
readonly
Returns the value of attribute jobfile.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize ⇒ Option
constructor
A new instance of Option.
- #parse!(argv) ⇒ Object
Constructor Details
#initialize ⇒ Option
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
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/ev_job_gen/cli/option.rb', line 6 def config @config end |
#jobfile ⇒ Object (readonly)
Returns the value of attribute jobfile.
6 7 8 |
# File 'lib/ev_job_gen/cli/option.rb', line 6 def jobfile @jobfile end |
#target ⇒ Object (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 |