Class: RandallRegExp::PosixCharClass

Inherits:
CharClass
  • Object
show all
Defined in:
lib/randall/charclass.rb

Instance Method Summary collapse

Methods inherited from CharClass

#rand

Methods included from CharSets

#all_chars, #control, #decimal_number, #graph, #letter, #lower_letter, #punctuation, #space, #strseq, #upper_letter, #word, #xchar, #xdigit

Instance Method Details

#charsObject



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/randall/charclass.rb', line 102

def chars
  return @chars if @chars
  
  @chars = case pcc_name.text_value
			when 'alnum'
 self.letter + self.digit
			when 'alpha'
 self.letter
			when 'ascii'
 self.ascii
			when 'blank'
 ["\s", "\t"]
			when 'cntrl'
 self.control
			when 'digit'
 self.digit
			when 'graph'
 self.graph
			when 'lower'
 self.lower
			when 'print'
 self.graph << "\s"
			when 'punct'
 self.punctuation
			when 'space'
 self.space
			when 'upper'
 self.upper
			when 'xdigit'
 self.xdigit
			when 'word'
 self.word
			else
[]
			end

			@chars = self.all_chars - @chars unless neg.empty?
			@chars
end