Sha256: c91c68960591b11756b420d7fcbeba147dac6b36f4dca633837d88eaa8e14c25

Contents?: true

Size: 369 Bytes

Versions: 43

Compression:

Stored size: 369 Bytes

Contents

class Array
  def insert_last(element)
    self + [element]
  end

  def single
    first if single?
  end

  def single!
    raise 'There is more than one element' unless single?
    first
  end

  def single?
    size == 1
  end

  def multiple?
    size > 1
  end

  def randomize_with(randomizer, seed)
    map { |it| it.randomize_with randomizer, seed }
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
mumuki-domain-8.3.1 lib/mumuki/domain/extensions/array.rb
mumuki-domain-8.2.0 lib/mumuki/domain/extensions/array.rb
mumuki-domain-8.1.3 lib/mumuki/domain/extensions/array.rb