Sha256: 312005f070315e84eb41a078eb0ac8029a8a486c08ece2b4f2d0fd1f77d77fd3

Contents?: true

Size: 288 Bytes

Versions: 1

Compression:

Stored size: 288 Bytes

Contents

module RangeOperations; end

module RangeOperations::Single
  # True if begin is greater than end
  def self.backwards?(r)
    r && r.begin > r.end
  end

  # Inverts backwards Ranges, leaves others unchanged
  def self.straighten(r)
    r.begin <= r.end ? r : r.end .. r.begin
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
range_operations-0.1.0 lib/range_operations/single.rb