Class: String
- Defined in:
- lib/ttk/symtbl.rb,
lib/ttk/dumpers/Xml.rb,
lib/ttk/strategies/Streams/Stream.rb
Instance Method Summary collapse
- #compare_stream(stream) ⇒ Object
- #symtbl_gsub(symtbl) ⇒ Object
- #xmlize ⇒ Object
- #xmlize_text ⇒ Object
Instance Method Details
#compare_stream(stream) ⇒ Object
109 110 111 |
# File 'lib/ttk/strategies/Streams/Stream.rb', line 109 def compare_stream ( stream ) self == stream.read end |
#symtbl_gsub(symtbl) ⇒ Object
112 113 114 |
# File 'lib/ttk/symtbl.rb', line 112 def symtbl_gsub ( symtbl ) return gsub(/<<(.*?)>>/) { symtbl[$1.to_sym] || $& } if self =~ /<<(.*)>>/ end |
#xmlize ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/ttk/dumpers/Xml.rb', line 72 def xmlize count = -1 ret = '' each_byte do |c| if count >= 80 then ret << "\\<br />" << c count = 0 elsif c == ?\n then ret << '<br />' count = 0 else ret << c count += 1 end end ret end |
#xmlize_text ⇒ Object
90 91 92 93 94 95 96 97 |
# File 'lib/ttk/dumpers/Xml.rb', line 90 def xmlize_text ret = xmlize if ret =~ /^[\w.,;!?\/@~+=*-]*$/ ret else REXML::CData.new(ret) end end |