We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c96ae8f commit 559ccb6Copy full SHA for 559ccb6
config/initializers/settingslogic.rb
@@ -0,0 +1,10 @@
1
+class Settingslogic < Hash
2
+ def method_missing(name, *args, &block)
3
+ super if name === :to_ary # delegate to_ary to Hash. see https://github.com/binarylogic/settingslogic/pull/36
4
+ key = name.to_s
5
+ return missing_key("Missing setting '#{key}' in #{@section}") unless has_key? key
6
+ value = fetch(key)
7
+ create_accessor_for(key)
8
+ value.is_a?(Hash) ? self.class.new(value, "'#{key}' section in #{@section}") : value
9
+ end
10
+end
0 commit comments