Class: ActiveInteractor::Configuration
- Inherits:
-
Object
- Object
- ActiveInteractor::Configuration
- Defined in:
- lib/active_interactor/configuration.rb
Overview
The Configuration object for the ActiveInteractor gem
Constant Summary collapse
- DEFAULTS =
The default configuration options for ActiveInteractor::Configuration
{ logger: Logger.new(STDOUT), dir_name: 'interactors' }.freeze
Instance Attribute Summary collapse
-
#dir_name ⇒ String
The directory name interactors are generated in.
-
#logger ⇒ Logger
An instance of Logger.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ActiveInteractor::Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(options = {}) ⇒ ActiveInteractor::Configuration
A new instance of ActiveInteractor::Configuration
31 32 33 34 35 36 |
# File 'lib/active_interactor/configuration.rb', line 31 def initialize( = {}) = DEFAULTS.merge(.dup || {}).slice(*DEFAULTS.keys) .each_key do |attribute| instance_variable_set("@#{attribute}", [attribute]) end end |
Instance Attribute Details
#dir_name ⇒ String
Returns The directory name interactors are generated in.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_interactor/configuration.rb', line 14 class Configuration # The default configuration options for {Configuration} # @return [Hash{Symbol => *}] DEFAULTS = { logger: Logger.new(STDOUT), dir_name: 'interactors' }.freeze attr_accessor :logger, :dir_name # A new instance of {Configuration} # @param options [Hash{Symbol => *}] the options to initialize the # configuration with. # @option options [Logger] :logger the logger ActiveInteractor should # use for logging # @option options [String] :dir_name he directory name interactors are generated in # @return [ActiveInteractor::Configuration] a new instance of {Configuration} def initialize( = {}) = DEFAULTS.merge(.dup || {}).slice(*DEFAULTS.keys) .each_key do |attribute| instance_variable_set("@#{attribute}", [attribute]) end end end |
#logger ⇒ Logger
Returns an instance of Logger.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_interactor/configuration.rb', line 14 class Configuration # The default configuration options for {Configuration} # @return [Hash{Symbol => *}] DEFAULTS = { logger: Logger.new(STDOUT), dir_name: 'interactors' }.freeze attr_accessor :logger, :dir_name # A new instance of {Configuration} # @param options [Hash{Symbol => *}] the options to initialize the # configuration with. # @option options [Logger] :logger the logger ActiveInteractor should # use for logging # @option options [String] :dir_name he directory name interactors are generated in # @return [ActiveInteractor::Configuration] a new instance of {Configuration} def initialize( = {}) = DEFAULTS.merge(.dup || {}).slice(*DEFAULTS.keys) .each_key do |attribute| instance_variable_set("@#{attribute}", [attribute]) end end end |