Class: Arugula::CharacterClassPart

Inherits:
Part
  • Object
show all
Includes:
MatchAny
Defined in:
lib/arugula/parts.rb

Instance Attribute Summary

Attributes included from MatchAny

#parts

Instance Method Summary collapse

Methods included from MatchAny

#initialize, #match

Methods inherited from Part

all, inherited, type

Instance Method Details

#to_sObject



85
86
87
88
89
90
91
92
93
94
# File 'lib/arugula/parts.rb', line 85

def to_s
  parts_string = parts.map do |part|
    next part unless part.class.type == :literal
    lit = part.literal
    lit = '\\]' if lit == ']'
    lit = '\\[' if lit == '['
    lit
  end.join
  "[#{parts_string}]"
end