Method: Enumerable#aT_all_numeric

Defined in:
lib/y_support/typing/enumerable/typing.rb

#aT_all_numeric(what_is_collection_element = nil) ⇒ Object

Fails with TypeError unless all the collection members declare compliance with Numeric. Second optional argument (collection element description) customizes the error message.

Raises:



54
55
56
57
58
59
# File 'lib/y_support/typing/enumerable/typing.rb', line 54

def aT_all_numeric what_is_collection_element=nil
  e = what_is_collection_element || "collection element"
  m = "Each #{e} must declare compliance with Numeric!"
  raise TErr, m unless all? { |e| e.class_complies? Numeric }
  return self
end