Sha256: 29e6cc653ebad063ff72c4ed5f4a90f66fc67ce7f79633a84629cf70131f3c0e
Contents?: true
Size: 567 Bytes
Versions: 1
Compression:
Stored size: 567 Bytes
Contents
require "active_support/core_ext/string/access" class String remove_method :to # Returns the substring from the start of the String, spanning through # a given position. # # This method replaces Active Support's +String#to+. It is faster. # # @example # "abcdef".to(0) # == "a" # "abcdef".to(2) # == "abc" # "abcdef".to(5) # == "abcdef" # "abcdef".to(6) # == "abcdef" # # @param position [Integer] # @return [String] def to(position) position += self.length if position < 0 self[0, position + 1] || "" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
casual_support-3.0.2 | lib/casual_support/string/to.rb |