Skip to content

Commit

Permalink
missing_key': Missing setting 'to_ary' in (Settingslogic::MissingSett…
Browse files Browse the repository at this point in the history
…ing)

Fix Array#flatten on an array containing a Settingslogic object
binarylogic#36
  • Loading branch information
gittmaan committed Mar 6, 2015
1 parent 020cced commit 3282d76
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/settingslogic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def initialize(hash_or_file = self.class.source, section = nil)
# Called for dynamically-defined keys, and also the first key deferenced at the top-level, if load! is not used.
# Otherwise, create_accessors! (called by new) will have created actual methods for each key.
def method_missing(name, *args, &block)
super if name === :to_ary # delegate to Hash
super if name === :to_str # delegate to Hash

key = name.to_s
return missing_key("Missing setting '#{key}' in #{@section}") unless has_key? key
value = fetch(key)
Expand Down

0 comments on commit 3282d76

Please sign in to comment.