Method: CommandKit::Commands::AutoRequire#command
- Defined in:
- lib/command_kit/commands/auto_require.rb
#command(command_name) ⇒ Class?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Attempts to load the command from the #dir and #namespace.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/command_kit/commands/auto_require.rb', line 117 def command(command_name) file_name = Inflector.underscore(command_name) begin require(file_name) rescue LoadError return end constant = Inflector.camelize(file_name) begin const_get(constant) rescue NameError return end end |