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

Use the same behaviour than Ruby 2.3 shellescape #2

Merged
merged 2 commits into from
Apr 24, 2020

Conversation

Morriar
Copy link
Contributor

@Morriar Morriar commented Apr 24, 2020

In it's current state the escape method doesn't accept Pathname instances:

> Shellwords.escape(Pathname.new(""))
NoMethodError:
       undefined method `gsub' for #<Pathname:>

As this gem rewrites the behaviour of the original method this can create surprising behavior:

> [Pathname.new("foo"), "bar"].shelljoin
NoMethodError:
       undefined method `gsub' for #<Pathname:>

This PR fixes this problem by following more closely the original implementation and thus supporting more than a mere string.

Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@envygeeks envygeeks merged commit 98f0be8 into envygeeks:master Apr 24, 2020
@envygeeks
Copy link
Owner

Thanks 💖

@Morriar Morriar deleted the at-escape-pathname branch April 27, 2020 13:52
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

Successfully merging this pull request may close these issues.

None yet

2 participants