Is there something built-in with Ruby to determine if a string is a reserved word? Something like "next".is_keyword??
Is there something built-in with Ruby to determine if a string is a reserved
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only way I can think of is loading an array with all the keywords you know about.
For reference:
public,protectedand friends aren’t really keywords, just the names of important methods which are called during the creation of modules or classes. You can think of it as elements of the Ruby DSL.