Class: Strling::Core::Backref
Overview
Represents a backreference.
Matches the same text as previously captured by a group, referenced either by index or by name.
Instance Attribute Summary collapse
-
#by_index ⇒ Integer?
The group index to reference.
-
#by_name ⇒ String?
The group name to reference.
Instance Method Summary collapse
-
#initialize(by_index: nil, by_name: nil) ⇒ Backref
constructor
A new instance of Backref.
- #to_dict ⇒ Object
Constructor Details
#initialize(by_index: nil, by_name: nil) ⇒ Backref
Returns a new instance of Backref.
399 400 401 402 |
# File 'lib/strling/core/nodes.rb', line 399 def initialize(by_index: nil, by_name: nil) @by_index = by_index @by_name = by_name end |
Instance Attribute Details
#by_index ⇒ Integer?
Returns The group index to reference.
392 393 394 |
# File 'lib/strling/core/nodes.rb', line 392 def by_index @by_index end |
#by_name ⇒ String?
Returns The group name to reference.
395 396 397 |
# File 'lib/strling/core/nodes.rb', line 395 def by_name @by_name end |
Instance Method Details
#to_dict ⇒ Object
404 405 406 407 408 409 |
# File 'lib/strling/core/nodes.rb', line 404 def to_dict data = { 'kind' => 'Backref' } data['byIndex'] = by_index unless by_index.nil? data['byName'] = by_name unless by_name.nil? data end |