class String
Educate Ruby 1.8.7 about the #chr method.
Public Instance Methods
chr()
click to toggle source
# File lib/asciidoctor/core_ext/1.8.7/string/chr.rb, line 3 def chr self[0..0] end
limit(size)
click to toggle source
Safely truncate the string to the specified number of bytes. If a multibyte char gets split, the dangling fragment is removed.
# File lib/asciidoctor/core_ext/1.8.7/string/limit.rb, line 5 def limit size return self unless size < bytesize result = (unpack %Q(a#{size}))[0] begin result.unpack 'U*' rescue ArgumentError result.chop! retry end result end