Class: RegExpr::Char

Inherits:
Segment show all
Defined in:
lib/regexpr.rb

Instance Attribute Summary

Attributes inherited from Segment

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Segment

deepest, #empty?, #initialize, #names, nooptimize, novalue, #optimize, optimize

Constructor Details

This class inherits a constructor from RegExpr::Segment

Class Method Details

.new(x) ⇒ Object



295
296
297
298
# File 'lib/regexpr.rb', line 295

def self.new x
	x= x.split( '').collect {|i| super i }
	x.size == 1 ? x[ 0] : RegExpr::Block.new( x)
end

Instance Method Details

#sizeObject



293
# File 'lib/regexpr.rb', line 293

def size() 1 end

#to_rObject



292
# File 'lib/regexpr.rb', line 292

def to_r() ::Regexp.quote @value end