Project

General

Profile

Actions

Feature #12012

closed

Add Boolean method

Added by ka8725 (Andrey Koleshko) over 6 years ago. Updated almost 6 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:73020]

Description

In Ruby we have methods with a capital letter which are used for implicit type casting. For example: Array, String, Integer and etc. But there is lack of one desired function that I recently define in all my projects - this is Boolean. I mean it would be great to have in Ruby the built-in function:

Boolean(nil) # => false
Boolean("") # => true - I'm not sure about this. It's more convenient to have false here
Boolean("false") # => true
Boolean("0") # => false
Boolean("1") # => false
Boolean("test") # => true

What do you think, guys, about this suggestion?


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Feature #11848: New #to_b method for String, Symbol, Numeric, NilClass, TrueClass and FalseClass.Rejectedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF