Module: Langusta::Codepoints

Defined in:
lib/langusta/codepoints.rb

Constant Summary collapse

GSUB_SELECTOR =
RUBY_VERSION < "1.9" ? :gsub18 : :gsub19

Class Method Summary collapse

Class Method Details

.gsub!(codepoint_array, regex, replacement) ⇒ Object



5
6
7
8
9
# File 'lib/langusta/codepoints.rb', line 5

def self.gsub!(codepoint_array, regex, replacement)
  string = Langusta.cp2utf8(codepoint_array)
  string = send(GSUB_SELECTOR, string, regex, replacement)
  codepoint_array.replace(Langusta.utf82cp(string))
end

.gsub18(string, oregex, replacement) ⇒ Object



11
12
13
# File 'lib/langusta/codepoints.rb', line 11

def self.gsub18(string, oregex, replacement)
  oregex.gsub(string, replacement)
end

.gsub19(string, regex, replacement) ⇒ Object



15
16
17
# File 'lib/langusta/codepoints.rb', line 15

def self.gsub19(string, regex, replacement)
  string.gsub(regex, replacement)
end