Class: Skunk::CommandFactory
- Inherits:
-
RubyCritic::CommandFactory
- Object
- RubyCritic::CommandFactory
- Skunk::CommandFactory
- Defined in:
- lib/skunk/command_factory.rb
Overview
Knows how to calculate the command that was request by the CLI user
Constant Summary collapse
- COMMAND_CLASS_MODES =
%i[version help default compare].freeze
Class Method Summary collapse
-
.command_class(mode) ⇒ Class
Returns the command class based on the command that was executed.
Class Method Details
.command_class(mode) ⇒ Class
Returns the command class based on the command that was executed
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/skunk/command_factory.rb', line 14 def self.command_class(mode) mode = mode.to_s.split("_").first.to_sym if COMMAND_CLASS_MODES.include? mode require "skunk/commands/#{mode}" Command.const_get(mode.capitalize) else require "skunk/commands/default" Command::Default end end |