Permalink
Browse files

Let #method_missing yield everything, not just HashWithStructAccess t…

…ypes
  • Loading branch information...
1 parent 4d63f58 commit 2720ed3b5b00149c6cd6de9664c12d6a30794e1d @mbklein mbklein committed Nov 12, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/confstruct/hash_with_struct_access.rb
@@ -134,19 +134,19 @@ def method_missing sym, *args, &block
end
name = sym.to_s.chomp('=').to_sym
+ result = nil
if args.length == 1
- self[name] = args[0]
+ result = self[name] = args[0]
else
result = self[name]
if result.nil? and block_given?
result = self[name] = HashWithStructAccess.new(@@hash_class.new)
end
-
- if result.is_a?(HashWithStructAccess) and block_given?
- eval_or_yield result, &block
- end
- result
end
+ if block_given?
+ eval_or_yield result, &block
+ end
+ result
end
def methods

0 comments on commit 2720ed3

Please sign in to comment.