[#75687] [Ruby trunk Bug#12416] struct rb_id_table lacks mark function — shyouhei@...
Issue #12416 has been reported by Shyouhei Urabe.
3 messages
2016/05/23
[#75763] [Ruby trunk Feature#12435] Using connect_nonblock to open TCP connections in Net::HTTP#connect — mohamed.m.m.hafez@...
Issue #12435 has been reported by Mohamed Hafez.
3 messages
2016/05/28
[#75774] Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock — Mohamed Hafez <mohamed.m.m.hafez@...>
Hi all, every now and then in my production server, I'm
4 messages
2016/05/30
[#75775] Re: Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock
— Mohamed Hafez <mohamed.m.m.hafez@...>
2016/05/30
Or does MRI's OpenSSL::SSL::SSLSocket#connect_nonblock just return
[#75782] Important: Somewhat backwards-incompatible change (Fwd: [ruby-cvs:62388] duerst:r55225 (trunk): * string.c: Activate full Unicode case mapping for UTF-8) — Martin J. Dürst <duerst@...>
V2l0aCB0aGUgY2hhbmdlIGJlbG93LCBJIGhhdmUgYWN0aXZhdGVkIGZ1bGwgVW5pY29kZSBjYXNl
4 messages
2016/05/31
[ruby-core:75589] [Ruby trunk Feature#11735] Porting String#squish and String#squish! from Ruby on Rails' Active Support
From:
shyouhei@...
Date:
2016-05-18 01:22:32 UTC
List:
ruby-core #75589
Issue #11735 has been updated by Shyouhei Urabe.
We looked at it on yesterday's developer meeting but didn't reach a consensus. This might be because the attendees are mostly Hanzi culture residents (they treat newlines and spaces differently). This doesn't mean an immediate NG but frankly, we need to study real-world use cases more.
Note #1: recent (2.3+) ruby has squiggly heredoc ("<<~"). This can save someone who originally used squish.
Note #2: as we discuss, I reached a conclusion that squish over SQL is dangerous. It can destroy SQL's string literals with spaces.
----------------------------------------
Feature #11735: Porting String#squish and String#squish! from Ruby on Rails' Active Support
https://bugs.ruby-lang.org/issues/11735#change-58723
* Author: Prem Sichanugrist
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Hi,
I have been using this `String#squish` method so many time when I'm using Rails, 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, after, and in-between the string.
For example:
~~~ruby
<<-SQL.squish
SELECT *
FROM users
WHERE users.username = 'sikachu'
SQL
#=> "SELECT * FROM users WHERE users.username='sikachu'"
~~~
Another example usage is when you are on the project that have a line length 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 currently
connecting to the internet and your proxy server is working.
WARNING
#=> Unable to connect to the server. Please double-check that you are currently 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 to 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)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>