Skip to content

Commit

Permalink
fix: support psych 4.0 gem
Browse files Browse the repository at this point in the history
  • Loading branch information
bibendi committed Jun 17, 2021
1 parent ba0b659 commit 4ec6d32
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/dip/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,19 @@ class << self
def load_yaml(file_path = path)
return {} unless File.exist?(file_path)

YAML.safe_load(
ERB.new(File.read(file_path)).result,
[], [], true
)&.deep_symbolize_keys! || {}
data = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("4.0.0")
YAML.safe_load(
ERB.new(File.read(file_path)).result,
aliases: true
)
else
YAML.safe_load(
ERB.new(File.read(file_path)).result,
[], [], true
)
end

data&.deep_symbolize_keys! || {}
end
end

Expand Down

0 comments on commit 4ec6d32

Please sign in to comment.