Class: Vito::CommandLine::String

Inherits:
Object
  • Object
show all
Defined in:
lib/vito/command_line/string.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ String

Returns a new instance of String.



4
5
6
# File 'lib/vito/command_line/string.rb', line 4

def initialize(argv)
  @argv = argv
end

Instance Method Details

#commandObject

Command is the first part of the command string, if any given:

vito commands

In this case, it’ll run the ‘commands` command.



26
27
28
# File 'lib/vito/command_line/string.rb', line 26

def command
  Vito::CommandLine::Command.new(self).command
end

#optionsObject

Options are anything that comes after dashes in the command line:

-f filename
--file filename


17
18
19
# File 'lib/vito/command_line/string.rb', line 17

def options
  Vito::CommandLine::Options.new(argv)
end

#runObject



8
9
10
# File 'lib/vito/command_line/string.rb', line 8

def run
  "Vito::Commands::#{command.camelize}".constantize.new(self).perform
end