Class: JsRegex::Converter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/js_regex/converter/base.rb

Overview

Template class. Implement #convert_data in subclasses and return instance of String or Node from it.

Instance Method Summary collapse

Instance Method Details

#convert(expression, context) ⇒ Object

returns instance of Node with #quantifier attached.



9
10
11
12
13
14
15
16
# File 'lib/js_regex/converter/base.rb', line 9

def convert(expression, context)
  self.context    = context
  self.expression = expression

  node = convert_data
  node = Node.new(node) if node.instance_of?(String)
  apply_quantifier(node)
end