[ruby-core:76566] [Ruby trunk Feature#12626] Add ceiling alias for ceil on Numeric objects

From: shevegen@...
Date: 2016-07-26 07:23:49 UTC
List: ruby-core #76566
Issue #12626 has been updated by Robert A. Heiler.


I do not have any particular pro or con opinion here; personally I would continue to use .ceil but if other people use .ceiling
by default, it is up to them, not me. There is more than one way to do something.

I should, however had, point out that you equated String to_str with to_s and they are not the same.

    http://blog.bigbinary.com/2012/06/26/to_str-in-ruby.html

----------------------------------------
Feature #12626: Add ceiling alias for ceil on Numeric objects
https://bugs.ruby-lang.org/issues/12626#change-59794

* Author: Jason Willems
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Proposing adding a `ceiling` alias to the `ceil` instance method for Numeric, Float, Integer.

Although `ceil` is familiar as it's an extremely common method name in other languages, `ceiling` is more readable. Several other methods exist in the standard library with aliased long and short forms. A few examples:

**Numeric**:
[:imaginary, :imag]
[:rectangular, :rect]
[:to_i, :to_int]
[:conjugate, :conj]

**String**:
[:to_str, :to_s]


Usage:

```ruby
> 2.71.ceil
 => 3
> 2.71.ceiling
 => 3
```


```ruby
> Fixnum.instance_methods.grep /ceil/
 => [:ceil, :ceiling] 
```

---Files--------------------------------
add_ceiling_alias.patch (4.47 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next