Sha256: 95058987af4c69a53c362c70d9c8d304cbf4e17740be1d5eff08624afd6344c7
Contents?: true
Size: 484 Bytes
Versions: 2
Compression:
Stored size: 484 Bytes
Contents
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
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
activesupport-3.0.pre | lib/active_support/core_ext/string/starts_ends_with.rb |
recliner-0.0.1 | vendor/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb |