class RuboCop::AST::RegexpNode

to all ‘regexp` nodes within RuboCop.
node when the builder constructs the AST, making its methods available
A node extension for `regexp` nodes. This will be used in place of a plain

def content

Returns:
  • (String) - a string of regexp content
def content
  children.select(&:str_type?).map(&:str_content).join
end

def regopt

Returns:
  • (RuboCop::AST::Node) - a regopt node
def regopt
  children.last
end

def to_regexp

Returns:
  • (Regexp) - a regexp of this node
def to_regexp
  option = regopt.children.map { |opt| OPTIONS.fetch(opt) }.inject(:|)
  Regexp.new(content, option)
end