lib/rails-settings/default.rb in rails-settings-cached-0.6.6 vs lib/rails-settings/default.rb in rails-settings-cached-0.7.0
- old
+ new
@@ -19,21 +19,15 @@
def [](key)
# foo.bar.dar Nested fetch value
return instance[key] if instance.key?(key)
keys = key.to_s.split('.')
- val = instance
- keys.each do |k|
- val = val.fetch(k.to_s, nil)
- break if val.nil?
- end
- val
+ instance.dig(*keys)
end
def instance
return @instance if defined? @instance
@instance = new
- @instance
end
end
def initialize
content = open(self.class.source_path).read