Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for alias is incorrect, cannot take String #23

Closed
dblock opened this issue Dec 5, 2013 · 5 comments
Closed

Documentation for alias is incorrect, cannot take String #23

dblock opened this issue Dec 5, 2013 · 5 comments

Comments

@dblock
Copy link

dblock commented Dec 5, 2013

http://ruby-doc.org/docs/keywords/1.9 incorrectly states that arguments to alias can be String. See rubocop/rubocop#657. I spent a long time trying to figure out whether

  • This is still an issue in the current documentation. I cannot for the life of me find the doc for alias in the current tree.
  • How to fix this for 1.9.x.

Help?

@zzak
Copy link

zzak commented Dec 6, 2013

Thanks for the report, I wasn't able to find this file in the current documentation.

Can you send me a link? Unfortunately we don't maintain ruby-doc.org, so I don't have access to their files.

After testing, you can't pass a string to alias, only a symbol or local variable name (can be undefined)

def foo
  "zomg"
end

alias "bar" foo #=> SyntaxError: (irb):10: syntax error, unexpected tSTRING_BEG

alias :bar foo
bar #=> "zomg"
# notice it creates a local variable named bar (used without the symbol syntax)

alias undefined foo
undefined #=> "zomg"

@dblock
Copy link
Author

dblock commented Dec 6, 2013

@zzak Can you find where alias is documented in the current documentation? I couldn't.

@zzak
Copy link

zzak commented Jan 21, 2014

@dblock alias isn't documented because its a keyword.

I started working on a ./doc/keywords.rdoc file which lists an (maybe) explains each keyword, but haven't had time to finish it.

If you're interested I can open a work in progress pull request and you can fork my branch if you'd like to help?

@dblock
Copy link
Author

dblock commented Feb 1, 2014

Def. open an issue and cc: me on it. Making no promises, but seems like it's something needed so me or someone will pick it up.

@zzak
Copy link

zzak commented Aug 7, 2015

Giving this a close since there has been no further update.

Anyone is welcome to improve the docs for keywords.

@zzak zzak closed this as completed Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants