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

Implement Dir.each_child #4953

Merged
merged 2 commits into from
Jan 10, 2018
Merged

Conversation

nomadium
Copy link
Contributor

@nomadium nomadium commented Jan 8, 2018

Hi folks,

This is another feature targeting Ruby 2.5 [1]: Dir.each_child (feature #11302).

Note: The test is copied from MRI.

Thanks for your review and feedback.

  1. Ruby 2.5 Support #4876

For more information, please see feature #11302.
Copy link
Member

@enebo enebo left a comment

Choose a reason for hiding this comment

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

Just curious about one thing but this look good.

RubyClass dirClass = runtime.getDir();
RubyDir dir = (RubyDir) dirClass.newInstance(context, new IRubyObject[]{_path}, block);

dir.each_child(context, block);
Copy link
Member

Choose a reason for hiding this comment

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

Does this path (block passed in) in MRI really ignore encoding param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good observation. I'm not really sure about MRI on this, but Dir::foreach JRuby method implementation is currently doing something similar if I'm not mistaken: https://github.com/jruby/jruby/blob/ruby-2.5/core/src/main/java/org/jruby/RubyDir.java#L481

I'll get back to this later with my findings.

@enebo enebo merged commit 19a43e1 into jruby:ruby-2.5 Jan 10, 2018
@nomadium nomadium deleted the implement-dir-each-child branch January 10, 2018 20:58
@enebo enebo added this to the JRuby 9.3.0.0 milestone Feb 21, 2018
@enebo enebo modified the milestones: JRuby 9.3.0.0, JRuby 9.2.0.0 Apr 23, 2018
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