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
merged 1 commit into from Jan 8, 2018

Conversation

Projects
None yet
2 participants
@ChrisBr
Contributor

ChrisBr commented Jan 7, 2018

for Ruby 2.5 support as in https://bugs.ruby-lang.org/issues/8499 stated.
#4876

Tests are already in master, https://github.com/jruby/jruby/blob/7bd10a61c70d7ab271f5a1403b64ef37eaaf036a/spec/ruby/core/hash/slice_spec.rb
Commit: 75e4522#diff-a265476d146c86ed0f4352a5735b7e4b

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

@enebo

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

enebo Jan 8, 2018

Member

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

enebo Jan 8, 2018

Member

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

@ChrisBr

This comment has been minimized.

Contributor

ChrisBr commented Jan 8, 2018

@enebo thanks, updated!

@enebo enebo added this to the JRuby 9.3.0.0 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
Details

@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