Module: Mutest::Util Private
- Defined in:
- lib/mutest/util.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Utility methods
Constant Summary collapse
- SizeError =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Error raised by ‘Util.one` if size is less than zero or greater than one
Class.new(IndexError)
Class Method Summary collapse
-
.one(array) ⇒ Object
private
Return only element in array if it contains exactly one member.
Class Method Details
.one(array) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return only element in array if it contains exactly one member
12 13 14 15 16 |
# 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 |