Class: Nendo::LispRegexp
- Inherits:
-
Object
- Object
- Nendo::LispRegexp
- Defined in:
- lib/nendo/ruby/types.rb
Instance Attribute Summary collapse
-
#ignoreCase ⇒ Object
readonly
Returns the value of attribute ignoreCase.
Instance Method Summary collapse
- #escape ⇒ Object
-
#initialize(str) ⇒ LispRegexp
constructor
A new instance of LispRegexp.
- #to_readable ⇒ Object
- #to_s ⇒ Object
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
#ignoreCase ⇒ Object (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
#escape ⇒ Object
187 188 189 |
# File 'lib/nendo/ruby/types.rb', line 187 def escape @exp.gsub( /\\/, "\\\\\\\\" ) end |
#to_readable ⇒ Object
184 185 186 |
# File 'lib/nendo/ruby/types.rb', line 184 def to_readable sprintf( "#/%s/", @exp ) + (@ignoreCase ? "i" : "") end |
#to_s ⇒ Object
181 182 183 |
# File 'lib/nendo/ruby/types.rb', line 181 def to_s sprintf( "/%s/", @exp ) + (@ignoreCase ? "i" : "") end |