class SyntaxTree::RegexpContent

RegexpContent represents the body of a regular expression.

/.+ #{pattern} .+/

In the example above, a RegexpContent node represents everything contained within the forward slashes.

Attributes

beginning[R]
String

the opening of the regular expression

parts[R]
Array[ StringDVar | StringEmbExpr | TStringContent ]

the parts of the

regular expression

Public Class Methods

new(beginning:, parts:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 9073
def initialize(beginning:, parts:, location:)
  @beginning = beginning
  @parts = parts
  @location = location
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 9101
def ===(other)
  other.is_a?(RegexpContent) && beginning === other.beginning &&
    parts === other.parts
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 9079
def accept(visitor)
  visitor.visit_regexp_content(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 9083
def child_nodes
  parts
end
Also aliased as: deconstruct
copy(beginning: nil, parts: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 9087
def copy(beginning: nil, parts: nil, location: nil)
  RegexpContent.new(
    beginning: beginning || self.beginning,
    parts: parts || self.parts,
    location: location || self.location
  )
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 9097
def deconstruct_keys(_keys)
  { beginning: beginning, parts: parts, location: location }
end