lib/cockpit/tree_hash.rb in cockpit-0.0.1.5 vs lib/cockpit/tree_hash.rb in cockpit-0.0.1.7
- old
+ new
@@ -94,11 +94,14 @@
def method_missing(meth, *args, &block)
options = args.extract_options!
meth = meth.to_s.gsub("=", "").to_sym
if args.empty?
- return self[meth] if self.has_key?(meth)
- found = get(meth).set_attributes(options)
+ if self.has_key?(meth)
+ found = self[meth]
+ else
+ found = get(meth).set_attributes(options)
+ end
found = found.instance_eval(&block) if block_given?
found
else
get(meth).set_attributes({:type => Cockpit.get_type(args.first)}.merge(options).merge(:value => args.first))
end
\ No newline at end of file