Sha256: e90f59263817c2a00bef87636c57fa9f04e363c7381b61fcf5c79189749df87d

Contents?: true

Size: 338 Bytes

Versions: 3

Compression:

Stored size: 338 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
end

class NilClass
  def insert_last(element)
    [element]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mumuki-domain-8.1.2 lib/mumuki/domain/extensions/array.rb
mumuki-domain-8.1.1 lib/mumuki/domain/extensions/array.rb
mumuki-domain-8.1.0 lib/mumuki/domain/extensions/array.rb