Get the coordinates of a face and a line

There is a face and a straight line, how can I use the selection method to get the coordinates of both.
If there is just one face or one line,I can achieve with the following code。

array = Sketchup.active_model.selection[0].vertices.collect{|v| v.position}

But if I select a face and a line at the same time, how do I get their coordinates?

model = Sketchup.active_model
ents  = model.selection.find_all {|e| e.respond_to?(:vertices) }
array = ents.map(&:vertices)
points = array.map {|subary| subary.map(&:position) }
points.flatten!
points.uniq!

Thanks a lot!Mr.Dan

Or even shorter

Sketchup.active_model.selection.select { |e| e.respond_to?(:vertices) }
        .flat_map(&:vertices).uniq.map(&:position)