lib/fat_table/patches.rb in fat_table-0.9.7 vs lib/fat_table/patches.rb in fat_table-0.9.8
- old
+ new
@@ -2,19 +2,16 @@
unless { a: 1 }.respond_to?(:fetch_values)
# Add fetch_values if this version of ruby does not define it.
class Hash
def fetch_values(*keys)
- result = []
- keys.each do |k|
- result <<
- if block_given?
- yield(self[k])
- else
- self[k]
- end
+ keys.map do |k|
+ if block_given?
+ yield(self[k])
+ else
+ self[k]
+ end
end
- result
end
end
end
unless ''.respond_to?(:match?)