Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/elizalab.rb
Overview
String
The code for the ELIZA lab (elizalab.rb) has the definition of a new method for strings that removes quotes from the beginning and ending of a string.
Instance Method Summary collapse
-
#unquote ⇒ Object
Call
s.unquote
to return a copy of strings
with double quotes removed from the beginning and end.
Instance Method Details
#unquote ⇒ Object
Call s.unquote
to return a copy of string s
with double quotes removed from the beginning and end.
Example:
>> s = '"Is it raining?"'
=> "\"Is it raining?\""
>> s.unquote
=> "Is it raining?"
794 795 796 797 798 799 800 |
# File 'lib/elizalab.rb', line 794 def unquote if self[0] == ?" && self[-1] == ?" return self.slice(1..-2) else return self end end |