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

Fix Pathname to String conversion #86

Merged
merged 1 commit into from
Feb 13, 2015
Merged

Fix Pathname to String conversion #86

merged 1 commit into from
Feb 13, 2015

Conversation

sevos
Copy link
Contributor

@sevos sevos commented Feb 13, 2015

No description provided.

@rwz
Copy link
Collaborator

rwz commented Feb 13, 2015

:((

That's dumb. Pathnames act as String pretty much everywhere, I wonder what's the big deal with this case. Anyways, thanks for the heads up.

rwz added a commit that referenced this pull request Feb 13, 2015
Fix Pathname to String conversion
@rwz rwz merged commit f6f6419 into tricknotes:master Feb 13, 2015
@sevos
Copy link
Contributor Author

sevos commented Feb 13, 2015

Just for the record:

2.2.0 :006 >   project = Pathname.new(File.expand_path("~/projects/core"))
 => #<Pathname:/Users/sevos/projects/core>
2.2.0 :007 > env = {}
 => {}
2.2.0 :008 > env.store "VARIABLE", project
 => #<Pathname:/Users/sevos/projects/core>
2.2.0 :009 > system env, "echo $VARIABLE"
TypeError: no implicit conversion of Pathname into String
    from (irb):9:in `system'
    from (irb):9
    from /Users/sevos/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'

@sevos
Copy link
Contributor Author

sevos commented Feb 13, 2015

The problem is that it implements only #to_s method where probably it should also implement #to_str method which is responsible of implicit conversion of an object to string: http://stackoverflow.com/questions/11182052/to-s-vs-to-str-and-to-i-to-a-to-h-vs-to-int-to-ary-to-hash-in-ruby

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.

2 participants