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

Support Dir.glob with Pathname. #21

Closed
wants to merge 2 commits into from
Closed

Conversation

craigw
Copy link
Contributor

@craigw craigw commented Jun 3, 2016

This works with stdlib:

require 'pathname'
p = Pathname.new('/')
Dir[p]
# => ["/"]

But before this change failed under MemFs:

TypeError:
  no implicit conversion of Pathname into String

This is more likely to be encountered in a Rails project where
Rails.root is a Pathname, but it's very possible to encounter this
in an Ruby project.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0001%) to 99.83% when pulling 24c56a2 on barkingiguana:master into fc1353a on simonc:master.

@craigw
Copy link
Contributor Author

craigw commented Jun 3, 2016

Hmm I don't think Travis is supporting Ruby older than 2.0.0 any more. It fails wit this message:

Gem::InstallError: ruby_dep requires Ruby version >= 2.0.0, ~> 2.0.

This works with stdlib:

    require 'pathname'
    p = Pathname.new('/')
    Dir[p]
    # => ["/"]

But before this change failed under MemFs:

    TypeError:
      no implicit conversion of Pathname into String

This is more likely to be encountered in a Rails project where
`Rails.root` is a `Pathname`, but it's very possible to encounter this
in an Ruby project.
@@ -216,6 +217,9 @@ module MemFs
it_behaves_like 'returning matching filenames', '/test?', %w[/test0 /test1 /test2]
it_behaves_like 'returning matching filenames', '/test[01]', %w[/test0 /test1]
it_behaves_like 'returning matching filenames', '/test[^2]', %w[/test0 /test1]
it_behaves_like 'returning matching filenames', Pathname.new('/'), %w[/]
it_behaves_like 'returning matching filenames', Pathname.new('/*'),
%w[/tmp /test0 /test1 /test2]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0001%) to 99.83% when pulling b37cca2 on barkingiguana:master into fc1353a on simonc:master.

@simonc
Copy link
Owner

simonc commented Jun 5, 2016

Hi @craigw. Thank you very much for your PR that's so cool! 😁

simonc pushed a commit that referenced this pull request Jun 5, 2016
This works with stdlib:

    require 'pathname'
    p = Pathname.new('/')
    Dir[p]
    # => ["/"]

But before this change failed under MemFs:

    TypeError:
      no implicit conversion of Pathname into String

This is more likely to be encountered in a Rails project where
`Rails.root` is a `Pathname`, but it's very possible to encounter this
in an Ruby project.

Closes #21.
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.

4 participants