Sha256: 60917f650e8400ff1d97e89cbe52cf477ad714ae5e0e8020d48e4348f71b2219
Contents?: true
Size: 628 Bytes
Versions: 7
Compression:
Stored size: 628 Bytes
Contents
# This code is free software; you can redistribute it and/or modify it under # the terms of the new BSD License. # # Copyright (c) 2010, Sebastian Staudt unless String.method_defined?(:start_with?) # Extends Ruby's own String class with method #start_with? for Ruby < 1.8.7 # # @author Sebastian Staudt # @since 0.3.0 class String # Returns true if this string starts with the given substring # # @param [String] start The substring to check # @return [Boolean] +true+ if this String starts with the given substring def start_with?(start) !/^#{start}/.match(self).nil? end end end
Version data entries
7 entries across 7 versions & 1 rubygems