class Array

The Array class

Public Instance Methods

ordered?() click to toggle source

Is ordered

Example:

>> [1,2,3].ordered?
=> true
# File lib/ordered.rb, line 8
def ordered?
  return true if self.empty?
  a = self.first
  self[1..-1].each { |b|
  return false if a > b
    a = b
  }
  true
end