Class: Ark::CLI::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/ark/cli/report.rb

Overview

Stores information parsed from the command line for later inspection

Instance Method Summary collapse

Constructor Details

#initialize(args, named, trailing, options, counts) ⇒ Report

Initialize a bare Report object



7
8
9
10
11
12
13
# File 'lib/ark/cli/report.rb', line 7

def initialize(args, named, trailing, options, counts)
  @args     = args
  @named    = named
  @trailing = trailing
  @options  = options
  @counts   = counts
end

Instance Method Details

#arg(name) ⇒ Object

Get an argument by name



21
22
23
# File 'lib/ark/cli/report.rb', line 21

def arg(name)
  return @named[name.to_s]
end

#argsObject

Return an array of all args parsed



16
17
18
# File 'lib/ark/cli/report.rb', line 16

def args
  return @args
end

#count(name) ⇒ Object

Get the toggle count for an option by name



41
42
43
# File 'lib/ark/cli/report.rb', line 41

def count(name)
  return @counts[name.to_s]
end

#opt(name) ⇒ Object

Get the value of an option by name



36
37
38
# File 'lib/ark/cli/report.rb', line 36

def opt(name)
  return @options[name.to_s]
end

#optsObject

Get a hash of all options and their values



31
32
33
# File 'lib/ark/cli/report.rb', line 31

def opts
  return @options
end

#trailingObject

Return an array of any arguments without names



26
27
28
# File 'lib/ark/cli/report.rb', line 26

def trailing
  return @trailing
end