Class: Serenity::TextLine

Inherits:
Line
  • Object
show all
Defined in:
lib/serenity/line.rb

Instance Attribute Summary

Attributes inherited from Line

#text

Instance Method Summary collapse

Methods inherited from Line

code, #initialize, literal, string, text, #to_s

Constructor Details

This class inherits a constructor from Serenity::Line

Instance Method Details

#escape_text(text) ⇒ Object



36
37
38
# File 'lib/serenity/line.rb', line 36

def escape_text text
  text.gsub(/['\\]/, '\\\\\&')
end

#to_bufObject



32
33
34
# File 'lib/serenity/line.rb', line 32

def to_buf
  " _buf << '" << escape_text(@text) << "';"
end