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 Hash#slice method #4949

merged 1 commit into from Jan 8, 2018


None yet
2 participants

ChrisBr commented Jan 7, 2018

for Ruby 2.5 support as in stated.

Tests are already in master,
Commit: 75e4522#diff-a265476d146c86ed0f4352a5735b7e4b

Do we want to cherry-pick the tests to ruby-2.5 branch?


Tiny style requests but as you are contributing more I will slowly give you small changes like this to match general style.

@JRubyMethod(name = "slice", rest = true)
public RubyHash slice(final ThreadContext context, final IRubyObject[] args) {
RubyHash result = newHash(getRuntime());

This comment has been minimized.


enebo Jan 8, 2018


Can you change this to context.runtime?

for (int i = 0; i < args.length; i++) {
IRubyObject key = args[i];
IRubyObject value = this.internalGet(key);
if(value != null)

This comment has been minimized.


enebo Jan 8, 2018


if (value != null) { // space after if and we only allow non-curly if it is all on one line.


This comment has been minimized.


ChrisBr commented Jan 8, 2018

@enebo thanks, updated!

@enebo enebo added this to the JRuby milestone Jan 8, 2018

@enebo enebo merged commit fefd7fa into jruby:ruby-2.5 Jan 8, 2018

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress

@enebo enebo modified the milestones: JRuby, JRuby Apr 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment