Sha256: ee809bbbe2d690c5793f4d5173cdb39474fe0883587e7ab4c0aad3f504554555
Contents?: true
Size: 1.07 KB
Versions: 7
Compression:
Stored size: 1.07 KB
Contents
module GitObjectBrowser module Models class WrappedObject < Hash def initialize(root, path, obj) super() self[:type] = { Directory => 'directory', PlainFile => 'file', Index => 'index', GitObject => 'object', Ref => 'ref', Reflog => 'reflog', PackIndex => 'pack_index', PackFile => 'pack_file', PackedObject => 'packed_object', InfoRefs => 'info_refs', PackedRefs => 'packed_refs', }[obj.class] self[:object] = obj.to_hash self[:root] = root self[:path] = path self[:working_dir] = File.basename(File.dirname(root.to_s)) case(self[:type]) when 'packed_object' sha1 = self[:object][:object][:sha1] unpacked_file = File.join(root.to_s, 'objects', sha1[0..1], sha1[2..-1]).to_s self[:unpacked] = File.exist?(unpacked_file) when 'pack_index' self.merge!(obj.page_data) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems