Project

General

Profile

Actions

Bug #9041

closed

Please add alias "starts_with?" to class String

Added by shevegen (Robert A. Heiler) over 10 years ago. Updated over 10 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
all
[ruby-core:57953]

Description

Hi.

We can do these:

FileUtils.touch 'test' # => ["test"]
File.exist? 'test' # => true
File.exists? 'test' # => true
'test'.start_with? 't' # => true

However, we can not use .starts_with?

'test'.starts_with? 't' NoMethodError: undefined method `starts_with?' for "test":String

I propose that, for proper english, and consistency with the duality of File.exist? and File.exists?
to also add alias starts_with? so that we can use proper english.

The proper english way to query such a question would be:

"Does the word abc start with an a?"
and in short form as factual, affirmative statement:
"abc starts with a."
whereas this here would be not proper english:
"abc start with a."

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0