Class: SimpleCommand::Dispatcher::Configuration
- Inherits:
-
Object
- Object
- SimpleCommand::Dispatcher::Configuration
- Defined in:
- lib/simple_command_dispatcher/configuration.rb
Overview
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.
Instance Attribute Summary collapse
-
#allow_custom_commands ⇒ Boolean
Gets/sets the allow_custom_commands configuration setting (defaults to false).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset ⇒ nil
Resets the configuration to use the default values.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
29 30 31 32 |
# File 'lib/simple_command_dispatcher/configuration.rb', line 29 def initialize # The default is to use any command that exposes a ::call class method. reset end |
Instance Attribute Details
#allow_custom_commands ⇒ Boolean
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
27 28 29 |
# File 'lib/simple_command_dispatcher/configuration.rb', line 27 def allow_custom_commands @allow_custom_commands end |
Instance Method Details
#reset ⇒ nil
Resets the configuration to use the default values.
38 39 40 41 |
# File 'lib/simple_command_dispatcher/configuration.rb', line 38 def reset @allow_custom_commands = false nil end |