Sha256: 6a20c4dfbf5b573f72a33d3f60482138f0337929ad4092418643e56dc3296a14
Contents?: true
Size: 643 Bytes
Versions: 2
Compression:
Stored size: 643 Bytes
Contents
require 'indented_io' module MetaDb class DbObject def dump puts self.class.to_s dump_attrs end def dump_attrs(*attrs) attrs = Array(attrs) attrs = self.class.attrs if attrs.empty? indent { for attr in Array(attrs) value = self.send(attr) case value when Array puts "#{attr}:" indent { value.each { |v| v.dump } } when DbObject puts "#{attr}: #{value.name} (#{value.class})" else puts "#{attr}: #{self.send(attr).inspect}" end end } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
meta_db-0.1.1 | lib/meta_db/dump.rb |
meta_db-0.1.0 | lib/meta_db/dump.rb |