From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 8DD5E19C022B for ; Thu, 26 Nov 2015 01:32:13 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id EB072B5D883 for ; Thu, 26 Nov 2015 02:03:19 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id C506F18CC7AF for ; Thu, 26 Nov 2015 02:03:19 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id CBB011204EA; Thu, 26 Nov 2015 02:03:16 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 0FEE91203A8 for ; Thu, 26 Nov 2015 02:03:12 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=Dr+Sn3ZnzZAf3ut3IvGtFaatR1o=; b=dLJKLXUct41OGcGQe/ Ip59UL2AUxwOcRvFpjtRiDSarC5a5wFv+Dhgt/MYgymez1RzL3um0Kj7Q/wGkbRH vTs9HEc1m5fes/iLwWemC0kCXqUoBAg007gDr3sNKK9QaUJ2nBdFmDRFLeIP2rLM 9BBZp+T4jUNm1pIo5tfqvxvBo= Received: by filter0414p1mdw1.sendgrid.net with SMTP id filter0414p1mdw1.25033.5655E9CA42 2015-11-25 17:03:06.68458536 +0000 UTC Received: from herokuapp.com (ec2-54-204-131-231.compute-1.amazonaws.com [54.204.131.231]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id 02Kwz1ryRVCZrGYU4paySw Wed, 25 Nov 2015 17:03:06.547 +0000 (UTC) Date: Wed, 25 Nov 2015 17:03:06 +0000 From: deivid.rodriguez@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Redmine-MailingListIntegration-Message-Ids: 46361 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11735 X-Redmine-Issue-Author: sikachu X-Redmine-Sender: deivid X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5gVokVwFufOTTLXKqB1oTwnHY2HvEv8KSoWY bZJTZ3hErKGmz52j582wX9wXUytP6/MJzejPh4a1b31m73YfPghLlwNeTve3c4Jh9SDROazBdMs3rG W6Z8RMkadUsVccQSu6lRou4tSg298lE+4pCh X-SendGrid-Contentd-ID: {"test_id":"1448470989"} X-ML-Name: ruby-core X-Mail-Count: 71685 Subject: [ruby-core:71685] [Ruby trunk - Feature #11735] Porting String#squish and String#squish! from Ruby on Rails' Active Support X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11735 has been updated by David Rodr=C3=ADguez. I don't think the two features are the same, and would find both of them us= eful. ---------------------------------------- Feature #11735: Porting String#squish and String#squish! from Ruby on Rails= ' Active Support https://bugs.ruby-lang.org/issues/11735#change-55089 * Author: Prem Sichanugrist * Status: Open * Priority: Normal * Assignee:=20 ---------------------------------------- Hi, I have been using this `String#squish` method so many time when I'm using R= ails, and I think it should be a useful addition to core. Here's the method on Rails' documentation: http://api.rubyonrails.org/v4.2.= 5/classes/String.html#method-i-squish This method is very useful when you have to write a multi-line string using= heredoc, but you actually does not care about the white-spaces before, aft= er, and in-between the string. For example: ~~~ruby <<-SQL.squish SELECT * FROM users WHERE users.username =3D 'sikachu' SQL #=3D> "SELECT * FROM users WHERE users.username=3D'sikachu'" ~~~ Another example usage is when you are on the project that have a line lengt= h code standard, and you have to write a long warning message that needs to= be printed to stdout: ~~~ruby puts <<-WARNING.squish Unable to connect to the server. Please double-check that you are current= ly connecting to the internet and your proxy server is working. WARNING #=3D> Unable to connect to the server. Please double-check that you are cur= rently connecting to the internet and your proxy server is working. ~~~ By the way, this is my first patch and my first time writing something in C= , so there might be something that does not look right to you. I'll happy t= o revise this patch (and learn about C in the process!) from your feedback. Thank you, Prem ---Files-------------------------------- 0001-Introduce-String-squish-and-String-squish.patch (4.67 KB) --=20 https://bugs.ruby-lang.org/