Method: ErgomentumRspec::Matchers::Array::MonotonicallyIncreasing#matches?

Defined in:
lib/ergomentum_rspec/matchers/array/be_monotonically_increasing.rb

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/ergomentum_rspec/matchers/array/be_monotonically_increasing.rb', line 11

def matches?(actual)
  @actual = actual
  derivative = actual.each_cons(2).map { |x, y| y <=> x }
  derivative.all? { |v| v >= 0 }
end