Class: ArgsParser::Args

Inherits:
Object
  • Object
show all
Defined in:
lib/argsparser/args.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options: {}, switches: {}) ⇒ Args

Returns a new instance of Args.



3
4
5
6
7
8
9
10
11
# File 'lib/argsparser/args.rb', line 3

def initialize(options: {}, switches: {})
  args = ARGV

  x = Parser.parse args, options, switches

  @switches = Switches.new(x[1])
  @options = Options.new(x[0])
  @data = x[2]
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



13
14
15
# File 'lib/argsparser/args.rb', line 13

def data
  @data
end

#optionsObject (readonly)

Returns the value of attribute options.



13
14
15
# File 'lib/argsparser/args.rb', line 13

def options
  @options
end

#switchesObject (readonly)

Returns the value of attribute switches.



13
14
15
# File 'lib/argsparser/args.rb', line 13

def switches
  @switches
end