lib/store/digest/object.rb
# Outputs a human-readable string representation of the object.
Outputs a human-readable string representation of the object.
Outputs a human - readable string representation of the object .
def to_s
    out = "#{self.class}\n  Digests:\n"
    digests.values.sort { |a, b| a.to_s <=> b.to_s }.each do |d|
      out << "    #{d}\n"
    end
    MANDATORY.each { |m| out << "  #{LABELS[m]}: #{send m}\n" }
    OPTIONAL.each do |o|
      val = send o
      out << "  #{LABELS[o]}: #{val}\n" if val
    end
    out << "Validation:\n"
    FLAG.each_index do |i|
      x = flags >> (3 - i) & 3
      out << ("  %-16s: %s\n" % [FLAG[i], STATE[x]])
    end
    out
  end
def to_s out = "#{self.class}\n  Digests:\n" digests . values . sort { | a , b | a . to_s <=> b . to_s } . each do | d | out << "    #{d}\n" end MANDATORY . each { | m | out << "  #{LABELS[m]}: #{send m}\n" } OPTIONAL . each do | o | val = send o out << "  #{LABELS[o]}: #{val}\n" if val end out << "Validation:\n" FLAG . each_index do | i | x = flags >> ( 3 - i ) & 3 out << ( "  %-16s: %s\n" % [ FLAG [ i ] , STATE [ x ] ] ) end out end
Outputs a human-readable string representation of the object.
Outputs a human - readable string representation of the object .
# disgorge the digests # now the fields # now the validation statuses