rails / thor

Thor is a toolkit for building powerful command-line interfaces.
http://whatisthor.com/
MIT License
5.11k stars 552 forks source link

Support `Thor::CoreExt::HashWithIndifferentAccess#slice` method #812

Closed shuuuuun closed 1 year ago

shuuuuun commented 1 year ago

resolve https://github.com/rails/thor/issues/804

This PR supports Thor::CoreExt::HashWithIndifferentAccess#slice.

hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => "bee"
hash.slice('foo')
# => {"foo"=>"bar"}
hash.slice(:foo)
# => {"foo"=>"bar"}

Thank you. 🌈

shuuuuun commented 1 year ago

Oh, this gem needs to support from Ruby 2.0...

shuuuuun commented 1 year ago

Hash#slice was added in Ruby 2.5, so earlier versions cannot support this. https://docs.ruby-lang.org/en/3.2/NEWS/NEWS-2_5_0.html#:~:text=Hash%23slice%20%5BFeature%20%238499%5D https://bugs.ruby-lang.org/issues/8499

rafaelfranca commented 1 year ago

Can you rebase this PR now?

shuuuuun commented 1 year ago

I have rebased the PR! It looks like the CI fail is the same as the one currently occurring in the main branch. https://github.com/rails/thor/actions/runs/4953317981

I'll rebase again once the issue is resolved in the main branch.

rafaelfranca commented 1 year ago

Fixed