Module: Tk::CoreExtensions::Regexp
- Defined in:
- lib/ffi-tk/core_extensions.rb
Instance Method Summary collapse
Instance Method Details
#to_tcl ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ffi-tk/core_extensions.rb', line 56 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 |