Sha256: 273b38ceb7eaa82c19a8f8668190a68f4d4733510f2f78c3b41612f5f640cc6e

Contents?: true

Size: 241 Bytes

Versions: 2

Compression:

Stored size: 241 Bytes

Contents

module PartitionMagic
  def partition_even_odd (&block)
    even = []
    odd = []
    each do |n|
      result = block.call(n)
      if result == true
        even << n
      else
        odd << n
      end
    end
    [even, odd]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
partition_magic-0.1.2 lib/partition_magic/partition_magic.rb
partition_magic-0.1.1 lib/partition_magic/partition_magic.rb