Class: RandallRegExp::PerlCharClass

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



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/randall/charclass.rb', line 144

def chars
  @chars ||= case self.text_value
  when '\s'
    self.space
  when '\S'
    self.all_chars - self.space
  when '\d'
    self.digit
  when '\D'
    self.all_chars - self.digit
  when '\h'
    self.xdigit
  when '\H'
    self.all_chars - self.xdigit
  when '\w'
    self.word
  when '\W'
    self.all_chars - self.word
  else
  	[]
  end
end