Skip to content

Commit

Permalink
Use real keyword args for plugin options
Browse files Browse the repository at this point in the history
  • Loading branch information
timriley committed Jan 31, 2022
1 parent 3e8eeb1 commit 5fa528d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/dry/system/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def initialize(name, mod, &block)
end

# @api private
def apply_to(system, options)
system.extend(stateful? ? mod.new(options) : mod)
def apply_to(system, **options)
system.extend(stateful? ? mod.new(**options) : mod)
system.instance_eval(&block) if block
system
end
Expand Down Expand Up @@ -90,13 +90,13 @@ def self.loaded_dependencies
# @return [self]
#
# @api public
def use(name, options = {})
def use(name, **options)
return self if enabled_plugins.include?(name)

raise PluginNotFoundError, name unless (plugin = Plugins.registry[name])

plugin.load_dependencies
plugin.apply_to(self, options)
plugin.apply_to(self, **options)

enabled_plugins << name

Expand Down
2 changes: 1 addition & 1 deletion lib/dry/system/plugins/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Env < Module
attr_reader :options

# @api private
def initialize(options)
def initialize(**options)
@options = options
end

Expand Down
2 changes: 1 addition & 1 deletion lib/dry/system/plugins/zeitwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.dependencies
attr_reader :options

# @api private
def initialize(options)
def initialize(**options)
@options = options
super()
end
Expand Down

0 comments on commit 5fa528d

Please sign in to comment.