class Array

Public Instance Methods

squash(separator=" ") click to toggle source

Simple implementation of hash squash for Hash#squash. See the Hash notes for more explanation.

For Array, we simply call squash on each item.

# File ext/array.rb, line 9
def squash(separator=" ")
  map do |m|
    if m.respond_to? :squash
      m.squash(separator)
    else
      m.to_s
    end
  end.flatten
end