From: "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@gmail.com>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:55343] [ruby-trunk - Feature #8499] Importing Hash#slice, Hash#slice!, Hash#except, and Hash#except! from ActiveSupport
Date: Thu, 6 Jun 2013 22:45:28 +0900 [thread overview]
Message-ID: <redmine.journal-39750.20130606224526@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-8499.20130606161245@ruby-lang.org
Issue #8499 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas).
+1
----------------------------------------
Feature #8499: Importing Hash#slice, Hash#slice!, Hash#except, and Hash#except! from ActiveSupport
https://bugs.ruby-lang.org/issues/8499#change-39750
Author: mrkn (Kenta Murata)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: current: 2.1.0
=begin RD
According to my experiences, the following two idioms often appeare in application codes.
(1) (({hash = other_hash.select { |k, | [:key1, :key2, :key3].include? k }}))
(2) (({hash = other_hash.reject { |k, | [:key1, :key2, :key3].include? k }}))
On Rails, they can be written in the following forms by using ActiveSupport's features.
(1) (({hash = other_hash.slice(:key1, :key2, :key3)}))
(2) (({hash = other_hash.except(:key1, :key2, :key3)}))
I think the latter forms are shorter and more readable than the former ones.
So I propose to import the following methods from ActiveSupport:
* (({Hash#slice}))
* (({Hash#slice!}))
* (({Hash#except}))
* (({Hash#except!}))
=end
--
http://bugs.ruby-lang.org/
next prev parent reply other threads:[~2013-06-06 14:12 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 7:12 [ruby-core:55330] [ruby-trunk - Feature #8499][Assigned] Importing Hash#slice, Hash#slice!, Hash#except, and Hash#except! from ActiveSupport mrkn (Kenta Murata)
2013-06-06 7:13 ` [ruby-core:55331] [ruby-trunk - Feature #8499] " sorah (Shota Fukumori)
2013-06-06 7:21 ` [ruby-core:55332] Re: [ruby-trunk - Feature #8499][Assigned] " Zachary Scott
2013-06-06 7:27 ` [ruby-core:55333] [ruby-trunk - Feature #8499] " nobu (Nobuyoshi Nakada)
2013-06-06 7:28 ` [ruby-core:55334] " mrkn (Kenta Murata)
2013-06-06 7:51 ` [ruby-core:55335] " mrkn (Kenta Murata)
2013-06-06 7:59 ` [ruby-core:55336] " nobu (Nobuyoshi Nakada)
2013-06-06 8:10 ` [ruby-core:55338] " mrkn (Kenta Murata)
2013-06-06 8:20 ` [ruby-core:55339] " charliesome (Charlie Somerville)
2013-06-06 13:43 ` [ruby-core:55342] " nobu (Nobuyoshi Nakada)
2013-06-06 13:45 ` rosenfeld (Rodrigo Rosenfeld Rosas) [this message]
2013-06-06 15:15 ` [ruby-core:55344] " prijutme4ty (Ilya Vorontsov)
2013-06-06 15:35 ` [ruby-core:55345] " Clay Trump
2013-06-06 15:38 ` [ruby-core:55346] " mrkn (Kenta Murata)
2013-06-06 16:50 ` [ruby-core:55347] Re: [ruby-trunk - Feature #8499][Assigned] " Zachary Scott
2013-06-06 18:22 ` [ruby-core:55348] [ruby-trunk - Feature #8499] " vipulnsward (Vipul Amler)
2013-06-07 1:37 ` [ruby-core:55352] " nobu (Nobuyoshi Nakada)
2013-07-26 13:58 ` [ruby-core:56205] " Glass_saga (Masaki Matsushita)
2013-07-27 6:22 ` [ruby-core:56220] " matz (Yukihiro Matsumoto)
2013-07-27 6:25 ` [ruby-core:56221] " znz (Kazuhiro NISHIYAMA)
2013-07-27 20:56 ` [ruby-core:56235] " nobu (Nobuyoshi Nakada)
2013-07-28 9:26 ` [ruby-core:56242] " mrkn (Kenta Murata)
2013-07-29 3:24 ` [ruby-core:56252] " Glass_saga (Masaki Matsushita)
2014-01-30 6:17 ` [ruby-core:60296] " shibata.hiroshi
2014-06-22 15:14 ` [ruby-core:63275] " nobu
2015-11-07 20:17 ` [ruby-core:71381] [Ruby trunk " keithrbennett
2017-09-07 10:26 ` [ruby-core:82698] [Ruby trunk Feature#8499] " glass.saga
2017-09-19 5:42 ` [ruby-core:82860] " glass.saga
2017-10-19 7:28 ` [ruby-core:83381] " knu
2017-10-19 7:48 ` [ruby-core:83382] [Ruby trunk Feature#8499][Closed] " muraken
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-39750.20130606224526@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).