Class: SimpleCommandDispatcher::Services::OptionsService

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_command_dispatcher/services/options_service.rb

Overview

Handles options for command execution and ensures proper initialization.

Examples:

options = OptionsService.new(options: { debug: true })
options.debug? # => true

Constant Summary collapse

DEFAULT_OPTIONS =

Default options for command execution

{
  debug: false
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(options: {}) ⇒ OptionsService

Initializes the options service with the provided options merged with defaults.

Options Hash (options:):

  • :debug (Boolean) — default: false

    enables debug logging when true



20
21
22
# File 'lib/simple_command_dispatcher/services/options_service.rb', line 20

def initialize(options: {})
  @options = DEFAULT_OPTIONS.merge(options)
end

Instance Method Details

#debug?Boolean

Returns true if debug mode is enabled. When enabled, debug logging will show command execution flow.



28
29
30
# File 'lib/simple_command_dispatcher/services/options_service.rb', line 28

def debug?
  options[:debug]
end