Class: Bosh::Cli::JobCommandArgs
- Defined in:
- lib/cli/job_command_args.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#index ⇒ Object
Returns the value of attribute index.
-
#job ⇒ Object
Returns the value of attribute job.
Instance Method Summary collapse
-
#initialize(args) ⇒ JobCommandArgs
constructor
A new instance of JobCommandArgs.
Constructor Details
#initialize(args) ⇒ JobCommandArgs
Returns a new instance of JobCommandArgs.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cli/job_command_args.rb', line 3 def initialize(args) job = args.shift err('Please provide job name') if job.nil? job, index = job.split('/', 2) if index if index =~ /^\d+$/ index = index.to_i else err('Invalid job index, integer number expected') end elsif args[0] =~ /^\d+$/ index = args.shift.to_i end self.job = job self.index = index self.args = args end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args
2 3 4 |
# File 'lib/cli/job_command_args.rb', line 2 def args @args end |
#index ⇒ Object
Returns the value of attribute index
2 3 4 |
# File 'lib/cli/job_command_args.rb', line 2 def index @index end |
#job ⇒ Object
Returns the value of attribute job
2 3 4 |
# File 'lib/cli/job_command_args.rb', line 2 def job @job end |