Module: Tk::CoreExtensions::Regexp
- Defined in:
- lib/ffi-tk/core_extensions.rb
Instance Method Summary collapse
Instance Method Details
#to_tcl ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ffi-tk/core_extensions.rb', line 83 def to_tcl = [] << 'i' if & ::Regexp::IGNORECASE != 0 << 'x' if & ::Regexp::EXTENDED != 0 << 'n' if & ::Regexp::MULTILINE != 0 if .empty? pattern = source else pattern = "(?#{.join})#{source}" end TclString.new('{' << pattern.gsub(/([^\\])(?=[{}])/, '\1\\\\\2') << '}') end |