Method: Fugu#shrink_array

Defined in:
lib/fugu.rb

#shrink_array(array) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/fugu.rb', line 55

def shrink_array(array)
  array.flatten.to_ranges.map do |r|
    if r.first == r.last
      r.first
    else
      "#{r.first}-#{r.last}"
    end
  end.join(",")
end