Sha256: 8581cff0bf6ce41924394ea1b0a340958fe1c2d1ae02e2de30aee21cd5981df5
Contents?: true
Size: 561 Bytes
Versions: 2
Compression:
Stored size: 561 Bytes
Contents
class Tefil::PercentPacker < Tefil::TextFilterBase def process_stream(in_io, out_io) in_io.each do |line| old_chars = line.split("") new_str = "" new_index = 0 old_index = 0 while old_index < old_chars.size if old_chars[old_index] == "%" new_str += [old_chars[(old_index +1) .. (old_index + 2)].join].pack("H*") old_index += 2 else new_str += old_chars[old_index] end old_index += 1 new_index += 1 end out_io.print new_str end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tefil-0.1.1 | lib/tefil/percentpacker.rb |
tefil-0.1.0 | lib/tefil/percentpacker.rb |