lib/praxis-mapper/resource.rb in praxis-mapper-4.4.1 vs lib/praxis-mapper/resource.rb in praxis-mapper-4.5
- old
+ new
@@ -143,14 +143,15 @@
end
end
def self.wrap(records)
- case records
- when nil
+ if records.nil?
return []
- when Enumerable
- return records.compact.collect { |record| self.for_record(record) }
+ elsif( records.is_a?(Enumerable) )
+ return records.compact.map { |record| self.for_record(record) }
+ elsif ( records.respond_to?(:to_a) )
+ return records.to_a.compact.map { |record| self.for_record(record) }
else
return self.for_record(records)
end
end