Class: Strling::Core::CharClass
Overview
Represents a character class.
Matches any character from the set defined by items. Can be negated to match any character NOT in the set.
Instance Attribute Summary collapse
-
#items ⇒ Array<ClassItem>
The items in the character class.
-
#negated ⇒ Boolean
Whether the class is negated.
Instance Method Summary collapse
-
#initialize(negated, items) ⇒ CharClass
constructor
A new instance of CharClass.
- #to_dict ⇒ Object
Constructor Details
#initialize(negated, items) ⇒ CharClass
Returns a new instance of CharClass.
293 294 295 296 |
# File 'lib/strling/core/nodes.rb', line 293 def initialize(negated, items) @negated = negated @items = items end |
Instance Attribute Details
#items ⇒ Array<ClassItem>
Returns The items in the character class.
289 290 291 |
# File 'lib/strling/core/nodes.rb', line 289 def items @items end |
#negated ⇒ Boolean
Returns Whether the class is negated.
286 287 288 |
# File 'lib/strling/core/nodes.rb', line 286 def negated @negated end |
Instance Method Details
#to_dict ⇒ Object
298 299 300 301 302 303 304 |
# File 'lib/strling/core/nodes.rb', line 298 def to_dict { 'kind' => 'CharClass', 'negated' => negated, 'items' => items.map(&:to_dict) } end |