class RegexpExamples::BackReferenceGroup
This is a bit magic… We substitute backreferences with PLACEHOLDERS. These are then, later, replaced by the appropriate value. (See BackReferenceReplacer
) The simplest example is /(a) 1/ - So, we temporarily treat the “result” of /1/ as being “BACKREF-PLACEHOLDER-1”. It later gets updated.
Constants
- PLACEHOLDER_FORMAT
Attributes
id[R]
Public Class Methods
new(id)
click to toggle source
# File lib/regexp-examples/groups.rb, line 189 def initialize(id) @id = id end
Public Instance Methods
result()
click to toggle source
# File lib/regexp-examples/groups.rb, line 193 def result [GroupResult.new(PLACEHOLDER_FORMAT % @id)] end