Project

General

Profile

Actions

Feature #5549

closed

Comparable#min, Comparable#max

Added by sawa (Tsuyoshi Sawada) over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-dev:44775]

Description

I request the following methods

Comparable#min(other)
Comparable#max(other)

which will work the same as

[self, other].min
[self, other].max

and can be defined as

module Comparable
def min other; [self, other].min end
def max other; [self, other].max end
end

Example use case: If you need to ensure that some calculated value becomes at least zero within a method chain.


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #4574: Numeric#withinRejectedmatz (Yukihiro Matsumoto)04/13/2011Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0