Class: Bosh::Cli::JobCommandArgs

Inherits:
Struct
  • Object
show all
Defined in:
lib/cli/job_command_args.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



2
3
4
# File 'lib/cli/job_command_args.rb', line 2

def args
  @args
end

#indexObject

Returns the value of attribute index

Returns:

  • (Object)

    the current value of index



2
3
4
# File 'lib/cli/job_command_args.rb', line 2

def index
  @index
end

#jobObject

Returns the value of attribute job

Returns:

  • (Object)

    the current value of job



2
3
4
# File 'lib/cli/job_command_args.rb', line 2

def job
  @job
end