1 module ActiveSupport
#:nodoc:
2 module CoreExtensions
#:nodoc:
4 # Additional string tests.
6 def self.append_features(base
)
7 if '1.8.7 and up'.respond_to
?(:start_with?)
9 alias_method
:starts_with?, :start_with?
10 alias_method
:ends_with?, :end_with?
15 alias_method
:start_with?, :starts_with?
16 alias_method
:end_with?, :ends_with?
21 # Does the string start with the specified +prefix+?
22 def starts_with
?(prefix
)
24 self[0, prefix
.length
] == prefix
27 # Does the string end with the specified +suffix+?
28 def ends_with
?(suffix
)
30 self[-suffix
.length
, suffix
.length
] == suffix