Class: Strling::Core::IRAlt
Overview
Represents an alternation (OR) operation in the IR.
Matches any one of the provided branches. Equivalent to the | operator in traditional regex syntax.
Instance Attribute Summary collapse
-
#branches ⇒ Array<IROp>
The alternative branches.
Instance Method Summary collapse
-
#initialize(branches) ⇒ IRAlt
constructor
A new instance of IRAlt.
- #to_dict ⇒ Object
Constructor Details
#initialize(branches) ⇒ IRAlt
Returns a new instance of IRAlt.
44 45 46 |
# File 'lib/strling/core/ir.rb', line 44 def initialize(branches) @branches = branches end |
Instance Attribute Details
#branches ⇒ Array<IROp>
Returns The alternative branches.
41 42 43 |
# File 'lib/strling/core/ir.rb', line 41 def branches @branches end |
Instance Method Details
#to_dict ⇒ Object
48 49 50 |
# File 'lib/strling/core/ir.rb', line 48 def to_dict { 'ir' => 'Alt', 'branches' => branches.map(&:to_dict) } end |