diff options
author | Xavier Noria <fxn@hashref.com> | 2009-11-09 21:35:43 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2009-11-09 22:16:51 +0100 |
commit | c0bb4c6ed2f5a5676569746e7bfd70405346ef8f (patch) | |
tree | 000167d186734157c6b299caf369d00818db1e4f /activesupport/lib/active_support/core_ext | |
parent | 004db18cb0f690486336f0fa141ad383c79f9558 (diff) | |
download | rails-c0bb4c6ed2f5a5676569746e7bfd70405346ef8f.tar.gz rails-c0bb4c6ed2f5a5676569746e7bfd70405346ef8f.tar.bz2 rails-c0bb4c6ed2f5a5676569746e7bfd70405346ef8f.zip |
String#start_with? and String#end_with? are not needed for Ruby >= 1.8.7, leaves their plural aliases though
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/starts_ends_with.rb | 14 |
1 files changed, 0 insertions, 14 deletions
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 |