Class: Inch::CLI::Arguments

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/cli/arguments.rb

Overview

Arguments parses given command-line arguments into the categories files, object_names, and switches.

Examples:


args = ["lib/*.rb", "README", "Foo", "Foo::Bar", "--color", "--all"]
arguments = ::Inch::CLI::Arguments.new(args)

arguments.files         # => ["lib/*.rb", "README"]
arguments.object_names  # => ["Foo", "Foo::Bar"]
arguments.switches      # => ["--color", "--all"]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Arguments

Returns a new instance of Arguments

Parameters:

  • args (Array<String>)

19
20
21
22
23
24
# File 'lib/inch/cli/arguments.rb', line 19

def initialize(args)
  @files = []
  @object_names = []
  @switches = []
  parse(args)
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files


16
17
18
# File 'lib/inch/cli/arguments.rb', line 16

def files
  @files
end

#object_namesObject (readonly)

Returns the value of attribute object_names


16
17
18
# File 'lib/inch/cli/arguments.rb', line 16

def object_names
  @object_names
end

#switchesObject (readonly)

Returns the value of attribute switches


16
17
18
# File 'lib/inch/cli/arguments.rb', line 16

def switches
  @switches
end