Class: Nendo::LispRegexp

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ LispRegexp

Returns a new instance of LispRegexp.



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

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

Instance Attribute Details

#ignoreCaseObject (readonly)

Returns the value of attribute ignoreCase.



190
191
192
# File 'lib/nendo/ruby/types.rb', line 190

def ignoreCase
  @ignoreCase
end

Instance Method Details

#escapeObject



187
188
189
# File 'lib/nendo/ruby/types.rb', line 187

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

#to_readableObject



184
185
186
# File 'lib/nendo/ruby/types.rb', line 184

def to_readable
  sprintf( "#/%s/", @exp ) + (@ignoreCase ? "i" : "")
end

#to_sObject



181
182
183
# File 'lib/nendo/ruby/types.rb', line 181

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