module Mutest::Util

Utility methods

Constants

SizeError

Error raised by `Util.one` if size is less than zero or greater than one

Public Class Methods

one(array) click to toggle source

Return only element in array if it contains exactly one member

@param array [Array]

@return [Object] first entry

# File lib/mutest/util.rb, line 12
def self.one(array)
  return array.first if array.one?

  raise SizeError, "expected size to be exactly 1 but size was #{array.size}"
end