Module: Interscript::Opal

Included in:
Interscript
Defined in:
lib/interscript/opal.rb

Constant Summary collapse

ALPHA_REGEXP =
'\p{L}'

Instance Method Summary collapse

Instance Method Details

#external_processing(mapping, string) ⇒ Object


18
19
20
# File 'lib/interscript/opal.rb', line 18

def external_processing(mapping, string)
  string
end

#mkregexp(regexpstring) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/interscript/opal.rb', line 5

def mkregexp(regexpstring)
  flags = 'u'
  if regexpstring.include? "(?i)"
    regexpstring = regexpstring.gsub("(?i)", "").gsub("(?-i)", "")
    flags = 'ui'
  end
  Regexp.new("/#{regexpstring}/#{flags}")
end

#sub_replace(string, pos, size, repl) ⇒ Object


14
15
16
# File 'lib/interscript/opal.rb', line 14

def sub_replace(string, pos, size, repl)
  string[0, pos] + repl + string[pos + size..-1]
end