[ruby-core:64084] [ruby-trunk - Feature #9319] [Closed] Add constant RUBY_KEYWORDS or a similar way to output which keywords exist at runtime

From: e@...
Date: 2014-07-27 21:14:54 UTC
List: ruby-core #64084
Issue #9319 has been updated by Zachary Scott.

Status changed from Assigned to Closed

We've added an rdoc file to the source tree that lists the current keywords of ruby, you can access it a couple of ways, such as:

$ ri ruby:keywords

or from irb:

help "ruby:keywords"


----------------------------------------
Feature #9319: Add constant RUBY_KEYWORDS or a similar way to output which keywords exist at runtime
https://bugs.ruby-lang.org/issues/9319#change-48093

* Author: Robert A. Heiler
* Status: Closed
* Priority: Normal
* Assignee: Zachary Scott
* Category: doc
* Target version: current: 2.2.0
----------------------------------------
Hi,

Would it be possible to list all keywords in Ruby, from within a running program?

Like RUBY_KEYWORDS or similar?

Reasoning: On IRB someone asked me if "in" is a keyword. I was not sure so I googled
because I could not remember right off the head (I later remembered that "in" must
be because it is used in a "for" loop).

It would be nice if we could ask ruby itself which keywords would be available,
i.e. stored in an array.

http://ruby-doc.org/docs/keywords/1.9/ has a nice description of all keywords
too, which is great.



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

In This Thread

Prev Next