Class: Nendo::LispRegexp

Inherits:
Object
  • Object
show all
Defined in:
lib/nendo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ LispRegexp

Returns a new instance of LispRegexp.



168
169
170
171
# File 'lib/nendo.rb', line 168

def initialize( str )
  @exp        = str[ 1 ... str.size ]
  @ignoreCase = (str[0] == 'i')
end

Instance Attribute Details

#ignoreCaseObject (readonly)

Returns the value of attribute ignoreCase.



178
179
180
# File 'lib/nendo.rb', line 178

def ignoreCase
  @ignoreCase
end

Instance Method Details

#escapeObject



175
176
177
# File 'lib/nendo.rb', line 175

def escape
  @exp.gsub( /\\/, "\\\\\\\\" )
end

#to_sObject



172
173
174
# File 'lib/nendo.rb', line 172

def to_s
  sprintf( "|%s|", @exp ) + (@ignoreCase ? "i" : "")
end