Sha256: a38ea69929dc2e22bc4524e026bef8d4964da7e59f287f33ebb5b0c716823a38

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

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

      # 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

12 entries across 12 versions & 1 rubygems

Version Path
simple_command_dispatcher-3.0.4 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-3.0.3 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-3.0.2 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-3.0.1 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-3.0.0 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-2.0.1 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-2.0.0 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-1.2.8 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-1.2.7 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-1.2.6 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-1.2.5 lib/simple_command_dispatcher/configuration.rb
simple_command_dispatcher-1.2.4 lib/simple_command_dispatcher/configuration.rb