lib/rgen/array_extensions.rb in rgen-0.6.2 vs lib/rgen/array_extensions.rb in rgen-0.6.5
- old
+ new
@@ -18,11 +18,13 @@
# This is a problem for Hash[] called with an (empty) array of tupels.
# It will call to_hash expecting a Hash as the result. When it gets an array instead,
# it fails with an exception. Make sure it gets a NoMethodException as without this
# extension and it will catch that and return an empty hash as expected.
#
+ # Similar problems exist for other Ruby built-in methods which are expected to fail.
+ #
return super unless (size == 0 &&
- m != :to_hash) ||
+ m != :to_hash && m != :to_str) ||
compact.any?{|e| e.is_a? RGen::MetamodelBuilder::MMBase}
# use an array to build the result to achiev similar ordering
result = []
inResult = {}
compact.each do |e|