Skip to content

Commit

Permalink
monkey patch settingslogic see binarylogic/settingslogic#36
Browse files Browse the repository at this point in the history
  • Loading branch information
weilu committed Mar 13, 2014
1 parent dcc45c3 commit e29face
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config/initializers/settingslogic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Settingslogic < Hash
def method_missing(name, *args, &block)
super if name === :to_ary # delegate to_ary to Hash. see https://github.com/binarylogic/settingslogic/pull/36
key = name.to_s
return missing_key("Missing setting '#{key}' in #{@section}") unless has_key? key
value = fetch(key)
create_accessor_for(key)
value.is_a?(Hash) ? self.class.new(value, "'#{key}' section in #{@section}") : value
end
end

0 comments on commit e29face

Please sign in to comment.