Sha256: 9054470b662ef88e41bd7360e19932ced712f8fc3f8f98075221b4b1f6711f12
Contents?: true
Size: 757 Bytes
Versions: 2
Compression:
Stored size: 757 Bytes
Contents
# frozen_string_literal: true require "rubycritic/command_factory" module Skunk module Cli # Knows how to calculate the command that was request by the CLI user class CommandFactory < RubyCritic::CommandFactory COMMAND_CLASS_MODES = %i[version help default].freeze # Returns the command class based on the command that was executed # # @param mode # @return [Class] def self.command_class(mode) mode = mode.to_s.split("_").first.to_sym if COMMAND_CLASS_MODES.include? mode require "skunk/cli/commands/#{mode}" Command.const_get(mode.capitalize) else require "skunk/cli/commands/default" Command::Default end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
skunk-0.2.0 | lib/skunk/cli/command_factory.rb |
skunk-0.1.0 | lib/skunk/cli/command_factory.rb |