Sha256: 094296557d20d8eeebac4754d4db461bc0da199a7778355088a2e7e9bd998b8e
Contents?: true
Size: 790 Bytes
Versions: 7
Compression:
Stored size: 790 Bytes
Contents
module Rugged class Tree include Enumerable def inspect data = "#<Rugged::Tree:#{object_id} {oid: #{oid}}>\n" self.each { |e| data << " <\"#{e[:name]}\" #{e[:oid]}>\n" } data end # Walks the tree but only yields blobs def walk_blobs(mode=:postorder) self.walk(mode) { |root, e| yield root, e if e[:type] == :blob } end # Walks the tree but only yields subtrees def walk_trees(mode=:postorder) self.walk(mode) { |root, e| yield root, e if e[:type] == :tree } end # Iterate over the blobs in this tree def each_blob self.each { |e| yield e if e[:type] == :blob } end # Iterat over the subtrees in this tree def each_tree self.each { |e| yield e if e[:type] == :tree } end end end
Version data entries
7 entries across 7 versions & 1 rubygems