This project is archived and is in readonly mode.
`starts/ends_with?` implementations incompatible with that of ruby 1.8.7
-
Mislav
- Tag changed from 1.8.7, activesupport, string to 1.8.7, activesupport, patch, string
-
CancelProfileIsBroken
- Tag changed from 1.8.7, activesupport, patch, string to 1.8.7, activesupport, bugmash, patch, string
-
Dmitry Maksimov
not reproducible
Tried on Rails 2.3.4 and rails starts/ends_with? methods work such as ruby 1.8.7 start/end_with? methods. -1 the patch is ok, but there is no bug, so there is no need in patch? -
John Pignata
verified the difference in implementations
+1 patch applies cleanly to master
-
Blue Box Chris
-1 Not reproducible
"foobar".ends_with?('bar') => true "foobar".ends_with?(:bar) => true
-
Matías Flores
+1 patch applies cleanly to 2-3-stable but failed in master
verified the difference in behavior Mislav was talking about
Some additional info: when you're confirming this issue be sure to test it with 1.8.6, as in 1.8.7 and above starts_with and ends_with are just aliases of ruby's start_with and end_with.
-
Elad Meidar
+1 verified the bug and the 2-3-stable patch applies cleanly, i've attached a patch for master, note that i didn't credit Mislav.. but only because i have no idea how to do it.
-
sr.iniv.t
In Ruby 1.8.6, there's no Symbol#length apparently (maybe I'm on an older patchlevel?):
ts > ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0] ts > irb irb(main):001:0> :str.length NoMethodError: undefined method `length' for :str:Symbol from (irb):1 -
Mislav
To those who claim they can't reproduce: my ruby version on Snow Leopard is
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]So if you can find another 1.8.7 version where this is not false:
"foobar".end_with(:bar)Then please report here. Otherwise, this patch is still valid.
Elad: the way of properly crediting people with
git commitis to either reference metadata from another commit (-c | -Coptions) or to use the--authoroption. -
Rizwan Reza
- Tag changed from 1.8.7, activesupport, bugmash, patch, string to 1.8.7, activesupport, patch, string
-
Mislav
- Tag changed from 1.8.7, activesupport, patch, string to 1.8.7, 2.3.x, activesupport, patch, string
Rebased the patch to 2-3-stable branch. Version of this patch for master isn't necessary because Rails 3.0 drops Ruby 1.8.6 support.
-
Repository
- State changed from new to committed
(from [c519215aa83b041d438772977f962f54fff81a83]) ruby 1.8.7 compat:
starts/ends_with?doesn't cast to stringstarts/ends_with?methods shouldn't cast argument to string because ruby 1.8.7 doesn't seem to do that. for example:"foobar".ends_with?(:bar) # => true in ActiveSupport implementation, false in ruby 1.8.7[#3199 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/c519215aa83b041d438772977f962f...
