class String

Bowling string means producing interpreter-safe text basing on ascii input.

Constants

ASCII_ALL
ASCII_LETTERS_CAP
ASCII_UTF
CARRIAGE_RETURN
CODEPOINT_ORIGIN
EM_SPACE
EN_SPACE
FIGURE_SPACE
FOUR_PER_EM_SPACE
HAIR_SPACE
HTML_ENTITIES
IDEOGRAPHIC_SPACE
MEDIUM_MATHEMATICAL_SPACE
NARROW_NO_BREAK_SPACE
NBSP
NULL
PUNCTUATION_SPACE
SIX_PER_EM_SPACE
SYMBOL_FOR_SPACE
THIN_SPACE
THREE_PER_EM_SPACE
UTF_ALL
UTF_ASCII
UTF_LETTERS_CAP
WIDESPACE
ZERO_WIDTH_NO_BREAK_SPACE
ZERO_WIDTH_SPACE

Public Instance Methods

bowl() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 79
def bowl
  (out = self.dup).bowl!
  out
end
bowl!() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 76
def bowl!
  self.gsub!(/[#{Regexp.quote(ASCII_ALL.join)}]/, UTF_ASCII)
end
capitalize() click to toggle source
# File lib/qipowl/utils/unicode_strings.rb, line 18
def capitalize
  Unicode::capitalize(self)
end
capitalize!() click to toggle source
# File lib/qipowl/utils/unicode_strings.rb, line 21
def capitalize!
  self.replace capitalize
end
carriage(spaces = true) click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 111
def carriage spaces = true
  self.gsub(/\R/, spaces ? " #{CARRIAGE_RETURN} " : "#{CARRIAGE_RETURN}")
end
downcase() click to toggle source
# File lib/qipowl/utils/unicode_strings.rb, line 6
def downcase
  Unicode::downcase(self)
end
downcase!() click to toggle source
# File lib/qipowl/utils/unicode_strings.rb, line 9
def downcase!
  self.replace downcase
end
hsub(hash) click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 72
def hsub hash
  (out = self.dup).hsub! hash
  out
end
hsub!(hash) click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 69
def hsub! hash
  self.gsub!(/#{hash.keys.join('|')}/, hash)
end
spacefy() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 93
def spacefy
  (out = self.dup).spacefy!
  out
end
spacefy!() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 90
def spacefy!
  self.gsub!(' ', SYMBOL_FOR_SPACE)
end
to_filename() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 127
def to_filename
  self.gsub(/[#{Regexp.quote(ASCII_SYMBOLS.join)}]/, UTF_ASCII).gsub(/\s/, "#{NBSP}")[0..50]
end
unbowl() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 86
def unbowl
  (out = self.dup).unbowl!
  out
end
unbowl!() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 83
def unbowl!
  self.gsub!(/[#{Regexp.quote(UTF_ALL.join)}]/, ASCII_UTF)
end
uncarriage(spaces = true) click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 114
    def uncarriage spaces = true
      self.gsub(spaces ? /\s?#{CARRIAGE_RETURN}\s?/ : /#{CARRIAGE_RETURN}/, %Q(
))
    end
unspacefy() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 100
def unspacefy
  (out = self.dup).unspacefy!
  out
end
unspacefy!() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 97
def unspacefy!
  self.gsub!(/#{SYMBOL_FOR_SPACE}/, ' ')
end
unuglify() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 105
def unuglify
  self.unbowl.unspacefy.uncarriage.strip
end
un␚ify() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 119
def un␚ify
  self.gsub(/␚(.*?)␚/, '')
end
upcase() click to toggle source
# File lib/qipowl/utils/unicode_strings.rb, line 12
def upcase
  Unicode::upcase(self)
end
upcase!() click to toggle source
# File lib/qipowl/utils/unicode_strings.rb, line 15
def upcase!
  self.replace upcase
end
vacant?() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 65
def vacant?
  nil? || empty?
end
wstrip() click to toggle source
# File lib/qipowl/core/monkeypatches.rb, line 123
def wstrip
  self.gsub(/#{NBSP}/, '')
end