ruby / TryRuby

This 4th iteration of TryRuby is a website where you can learn the Ruby language.
https://try.ruby-lang.org
MIT License
224 stars 97 forks source link

Fix loading code from URI #139

Closed XrXr closed 1 year ago

XrXr commented 1 year ago

Previously, if you hit the "Copy URL" button and visit the URL in a different tab, you would not get the code that you had in the editor. For example, try https://try.ruby-lang.org/playground/#code=no&engine=cruby-3.2.0dev I see the default code snippet in the editor when the url is supposed to encode "no".

Additionally, if you edit the code in the URL and hit enter, you'd get a error in the JS console.

Both of these issue were caused by getting a string back that start with a '#'. Delete this prefix.

cc @hmdne

hmdne commented 1 year ago

Thanks! I added a couple of tests to ensure all this works in the future