class Resync::XML::HashCodesNode

Maps the whitespace-separated list of hash codes in a +<rs:ln>+ or +<rs:md>+ tag to a hash of digest values keyed by hash algorithm. (See {Resync::Descriptor#hashes}.)

Public Instance Methods

to_value(xml_text) click to toggle source
# File lib/resync/xml.rb, line 69
def to_value(xml_text)
  return {} unless xml_text
  return xml_text if xml_text.is_a?(Hash)
  xml_text.split(/[[:space:]]+/).map { |hash| hash.split(':') }.to_h
end
to_xml_text(value) click to toggle source
# File lib/resync/xml.rb, line 75
def to_xml_text(value)
  value.map { |k, v| "#{k}:#{v}" }.join(' ') if value && !value.empty?
end