Class: Array
Instance Method Summary collapse
-
#split(value = nil) ⇒ Object
From rails.
Instance Method Details
#split(value = nil) ⇒ Object
From rails
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rhc/core_ext.rb', line 28 def split(value = nil) using_block = block_given? inject([[]]) do |results, element| if (using_block && yield(element)) || (value == element) results << [] else results.last << element end results end end |