From c0bb4c6ed2f5a5676569746e7bfd70405346ef8f Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:35:43 +0100 Subject: String#start_with? and String#end_with? are not needed for Ruby >= 1.8.7, leaves their plural aliases though --- .../lib/active_support/core_ext/string/starts_ends_with.rb | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb b/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb index f65bb8f75b..641acf62d0 100644 --- a/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +++ b/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb @@ -1,18 +1,4 @@ class String - unless '1.8.7 and up'.respond_to?(:start_with?) - # Does the string start with the specified +prefix+? - def start_with?(prefix) - prefix = prefix.to_s - self[0, prefix.length] == prefix - end - - # Does the string end with the specified +suffix+? - def end_with?(suffix) - suffix = suffix.to_s - self[-suffix.length, suffix.length] == suffix - end - end - alias_method :starts_with?, :start_with? alias_method :ends_with?, :end_with? end -- cgit v1.2.3