Class: Array

Inherits:
Object
  • Object
show all
Defined in:
ext/array.rb

Instance Method Summary collapse

Instance Method Details

#squash(separator = " ") ⇒ Object

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

For Array, we simply call squash on each item.



9
10
11
12
13
14
15
16
17
# 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