Class: Strling::Core::IRCharClass
Overview
Represents a character class in the IR.
Matches any character from the set defined by items.
Instance Attribute Summary collapse
-
#items ⇒ Array<IRClassItem>
The items in the character class.
-
#negated ⇒ Boolean
Whether the class is negated.
Instance Method Summary collapse
-
#initialize(negated, items) ⇒ IRCharClass
constructor
A new instance of IRCharClass.
- #to_dict ⇒ Object
Constructor Details
#initialize(negated, items) ⇒ IRCharClass
Returns a new instance of IRCharClass.
199 200 201 202 |
# File 'lib/strling/core/ir.rb', line 199 def initialize(negated, items) @negated = negated @items = items end |
Instance Attribute Details
#items ⇒ Array<IRClassItem>
Returns The items in the character class.
195 196 197 |
# File 'lib/strling/core/ir.rb', line 195 def items @items end |
#negated ⇒ Boolean
Returns Whether the class is negated.
192 193 194 |
# File 'lib/strling/core/ir.rb', line 192 def negated @negated end |
Instance Method Details
#to_dict ⇒ Object
204 205 206 207 208 209 210 |
# File 'lib/strling/core/ir.rb', line 204 def to_dict { 'ir' => 'CharClass', 'negated' => negated, 'items' => items.map(&:to_dict) } end |