Skip to content

Commit

Permalink
Add injected method for setting config path
Browse files Browse the repository at this point in the history
  • Loading branch information
apexatoll committed Nov 12, 2023
1 parent 5f88181 commit 644fe51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/kangaru/injected_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def configure(env = nil, &)
Kangaru.application!.configure(env, &)
end

def import_config_from!(path)
Kangaru.application!.config_path = path
end

def apply_config!
Kangaru.application!.apply_config!
end
Expand Down
2 changes: 2 additions & 0 deletions sig/kangaru/injected_methods.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module Kangaru

def apply_config!: -> void

def import_config_from!: (String) -> void

def database: -> Database?
end

Expand Down
2 changes: 1 addition & 1 deletion spec/features/importing_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
module SomeGem
extend Kangaru::Initialiser
Kangaru.application.config_path = "#{config_path}"
import_config_from! "#{config_path}"
apply_config!
end
Expand Down

0 comments on commit 644fe51

Please sign in to comment.