Class: HTTY::CLI::Commands::Require

Inherits:
HTTY::CLI::Command
  • Object
show all
Defined in:
lib/htty/rack/commands/require.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.categoryObject

Returns the name of a category under which help for the require command should appear.



5
6
7
# File 'lib/htty/rack/commands/require.rb', line 5

def self.category
  'Rack'
end

.command_line_argumentsObject

Returns the arguments for the command-line usage of the require command.



10
11
12
# File 'lib/htty/rack/commands/require.rb', line 10

def self.command_line_arguments
  'file'
end

.helpObject

Returns the help text for the require command.



15
16
17
# File 'lib/htty/rack/commands/require.rb', line 15

def self.help
  'requires a file'
end

.help_extendedObject

Returns the extended help text for the require command.



20
21
22
23
# File 'lib/htty/rack/commands/require.rb', line 20

def self.help_extended
  'allows you to require a file. Works like rubys require and allows you' +
  'to load apps.'
end

Instance Method Details

#performObject

Performs the require command.



26
27
28
29
30
31
32
33
# File 'lib/htty/rack/commands/require.rb', line 26

def perform
  unless arguments.length == 1
     raise ArgumentError,
           "wrong number of arguments (#{arguments.length} for 1)"
  end

  require arguments.first
end