Sha256: ddabb8f73c6abd8c366b2d7719e279276f243b142a9c26cd1011d5de4c8bcaed
Contents?: true
Size: 745 Bytes
Versions: 19
Compression:
Stored size: 745 Bytes
Contents
module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module String #:nodoc: # Additional string tests. module StartsEndsWith def self.included(base) base.class_eval do alias_method :start_with?, :starts_with? alias_method :end_with?, :ends_with? end end # Does the string start with the specified +prefix+? def starts_with?(prefix) prefix = prefix.to_s self[0, prefix.length] == prefix end # Does the string end with the specified +suffix+? def ends_with?(suffix) suffix = suffix.to_s self[-suffix.length, suffix.length] == suffix end end end end end
Version data entries
19 entries across 19 versions & 4 rubygems