Skip to content

Commit

Permalink
Merge pull request #33 from stitchfix/sds/make-quiet-optional
Browse files Browse the repository at this point in the history
Make Hashie >= 4.0 optional
  • Loading branch information
shawnstephens authored Jan 24, 2023
2 parents deff198 + bf0286b commit 87ffebf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fittings.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "fittings"
s.version = "3.0.1"
s.version = "3.0.2"

s.authors = ["Edwin Cruz", "Colin Shield"]
s.date = %q{2011-09-06}
Expand All @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.required_ruby_version = ">= 2.4.0"
s.add_dependency("hashie", ">= 4.0")
s.add_dependency("hashie")
s.add_development_dependency "rspec"
s.add_development_dependency "rake"
s.add_development_dependency "rdoc"
Expand Down
17 changes: 15 additions & 2 deletions lib/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def self.available_settings
#=================================================================

def initialize
@available_settings ||= Hashie::Mash.quiet(:default).new
@available_settings ||= new_available_settings
end

def has_key?(key)
Expand Down Expand Up @@ -146,7 +146,7 @@ def loaded?

def load(params)
# reset settings hash
@available_settings = Hashie::Mash.quiet(:default).new
@available_settings = new_available_settings
@loaded = false

files = []
Expand Down Expand Up @@ -177,4 +177,17 @@ def load(params)
@loaded = true
@available_settings
end

private

def new_available_settings
# Spectre and other monoliths are tied to Hashie 3.x
# so once that isn't a problem and all apps can use Hashie >= 4.0
# then then Hashie::Mash.quiet can become the default.
if Hashie::Mash.respond_to?(:quiet)
Hashie::Mash.quiet(:default).new
else
Hashie::Mash.new
end
end
end

0 comments on commit 87ffebf

Please sign in to comment.