I think your question is kinda abstractive because many Rails/Ruby methods is mostly for special cases and many of them might be not used ever by most of the projects.
четверг, 27 февраля 2020 г., 0:31:38 UTC+2 пользователь Thushara Wijeratna написал: > > What would be a typical use case for such a function - I can understand > the special case of wanting to remove the first / last items in the array, > but an arbitrary one? > > On Wednesday, February 26, 2020 at 4:25:52 AM UTC-8, Alex Golubenko wrote: >> >> I'm totally agree that it might be confusing so yeah, maybe >> `#except_index` will be the best variant 😅 >> >> ср, 26 февр. 2020 г., 14:19 Nicholas Schwaderer <nicholas....@gmail.com>: >> >>> Nice suggestion! :) >>> >>> I see how it would replicate the Hash#except syntax as seen here: >>> https://apidock.com/rails/Hash/except >>> >>> However, could this be confusing for those who don't anticipate the >>> index stripping behavior but more of a reject/excluding behavior? >>> >>> i.e.: >>> >>> ``` >>> %w( 1 5 6 8 0 9 0 ).except(0) >>> #=> [5,6,8,0,9,0] >>> ``` >>> >>> Would it be better to explicitly add the index to the name such as >>> `#except_index` or more verbose `#except_with_index` ? >>> >>> >>> >>> On Wednesday, February 26, 2020 at 8:49:07 AM UTC, Alex Golubenko wrote: >>>> >>>> It wouldn't be alias 😅 >>>> The main idea is to implement method which we can use to exclude >>>> elements from array by their indexes. >>>> >>>> For example: >>>> %w( a b c d e f).except(0, -1) >>>> => ['b', 'c', 'd', 'e'] >>>> >>>> ср, 26 февр. 2020 г., 06:34 Josh Brody <jo...@josh.mn>: >>>> >>>>> Would this alias Array#excluding? I think the Array#except is natural >>>>> and I’ve found myself asking why it’s not aliased already many times but >>>>> I’m not the one to ask. 🙂 >>>>> >>>>> Sent from my iPhone >>>>> >>>>> On Feb 25, 2020, at 10:21 PM, Alex Golubenko <alexandr1...@gmail.com> >>>>> wrote: >>>>> >>>>> >>>>> Hi guys! >>>>> >>>>> Time to time I meet questions on SO about how to take elements from >>>>> array avoid some indexes. >>>>> >>>>> I think it might be helpful for many developers to have something like >>>>> `Hash#except` but for `Array`. >>>>> >>>>> I would like to add PR with it if someone interested in it. >>>>> >>>>> Thanks in advance for any thoughts about this idea. >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Ruby on Rails: Core" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to rubyonra...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/rubyonrails-core/479e2902-3cb1-4bb3-9347-5aeefe27379d%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/rubyonrails-core/479e2902-3cb1-4bb3-9347-5aeefe27379d%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Ruby on Rails: Core" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to rubyonra...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/rubyonrails-core/CAECA2F2-A2E4-4AD1-842B-1FCB9331CB78%40josh.mn >>>>> >>>>> <https://groups.google.com/d/msgid/rubyonrails-core/CAECA2F2-A2E4-4AD1-842B-1FCB9331CB78%40josh.mn?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ruby on Rails: Core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to rubyonra...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/rubyonrails-core/6904f0ef-9b96-432d-95a4-f35d8892303b%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/rubyonrails-core/6904f0ef-9b96-432d-95a4-f35d8892303b%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/c0640f5d-3775-46be-9783-eefeca65b075%40googlegroups.com.