Sha256: 7e641f224d23a3cf8d4fe95df9740bdce182b574c58400de7d7a007a1729d834

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

module SimpleCommand
	module Dispatcher

      # Gem configuration settings class. Use this class to configure this gem.
      #
      # To configure this gem in your application, simply add the following code in your application and set the
      # appropriate configuration settings.
      #
      # @example
      #
      #    SimpleCommand::Dispatcher.configure do |config|
      #       config.allow_custom_commands = true
      #    end 
      #
  		class Configuration
         # Gets/sets the *allow_custom_commands* configuration setting (defaults to false). 
         # If this setting is set to *false*, only command classes that prepend the *SimpleCommand* module
         # will be considered acceptable to run, all other command classes will fail to run. If this
         # setting is set to *true*, any command class will be considered acceptable to run, regardless of
         # whether or not the class prepends the *SimpleCommand* module.
         #
         # For information about the simple_command gem, visit {https://rubygems.org/gems/simple_command}
         #
         # @return [Boolean] the value.
         #
  			attr_accessor :allow_custom_commands

  			def initialize
  				# The default is to use any command that exposes a ::call class method.
      		reset
    		end

         public

         # Resets the configuration to use the default values.
         #
         # @return [nil] returns nil.
         #
    		def reset
    			@allow_custom_commands = false
            nil
    		end
  		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_command_dispatcher-1.2.3 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-1.2.2 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-1.2.1 lib/simple_command_dispatcher/configuration.rb