3 joined = tags.collect { |k,v| "#{escape_string(k)}=#{escape_string(v)}" }.join(';')
4 joined = '' if joined.nil?
8 def self.escape_string(tag)
9 return tag.gsub(/[;=\\]/) { |v| escape_char(v) }
12 def self.escape_char(v)
14 when ';' then return '\\s'
15 when '=' then return '\\e'
21 tags.split(';').each do |tag|
22 key,val = tag.split('=').collect { |s| s.strip }
25 if key != '' && val != ''
26 yield unescape_string(key),unescape_string(val)
31 def self.unescape_string(tag)
32 return tag.gsub(/\\[se\\]/) { |v| unescape_char(v) }
35 def self.unescape_char(v)
37 when '\\s' then return ';'
38 when '\\e' then return '='