Class: MigemoRegex::RegexEmacsRenderer
- Inherits:
-
RegexRenderer
- Object
- RegexRenderer
- MigemoRegex::RegexEmacsRenderer
- Defined in:
- lib/migemo-regex.rb
Instance Attribute Summary
Attributes inherited from RegexRenderer
Instance Method Summary collapse
- #escape_charclass(string) ⇒ Object
- #escape_string(string) ⇒ Object
-
#initialize(regex, insertion) ⇒ RegexEmacsRenderer
constructor
A new instance of RegexEmacsRenderer.
Methods inherited from RegexRenderer
Constructor Details
#initialize(regex, insertion) ⇒ RegexEmacsRenderer
Returns a new instance of RegexEmacsRenderer.
277 278 279 280 |
# File 'lib/migemo-regex.rb', line 277 def initialize (regex, insertion) super(regex, insertion) @meta = RegexEmacsMetachars.new end |
Instance Method Details
#escape_charclass(string) ⇒ Object
296 297 298 |
# File 'lib/migemo-regex.rb', line 296 def escape_charclass (string) string end |
#escape_string(string) ⇒ Object
282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/migemo-regex.rb', line 282 def escape_string (string) str = Regexp.quote(string) str.gsub!(/\\\(/, "(") str.gsub!(/\\\)/, ")") str.gsub!(/\\\|/, "|") str.gsub!(/\\\</, "<") str.gsub!(/\\\>/, ">") str.gsub!(/\\\=/, "=") str.gsub!(/\\\'/, "'") str.gsub!(/\\\`/, "`") str.gsub!(/\\\{/, "{") str end |