Class: Serenity::CodeLine

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

Direct Known Subclasses

LiteralLine, StringLine

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_code(code) ⇒ Object



46
47
48
# File 'lib/serenity/serenity/line.rb', line 46

def escape_code code
  code.mgsub! [[/&apos;/, "'"], [/&gt;/, '>'], [/&lt/, '<'], [/&quot;/, '"'], [/&amp;/, '&']]
end

#to_bufObject



42
43
44
# File 'lib/serenity/serenity/line.rb', line 42

def to_buf
  escape_code(@text) << ';'
end