Sha256: cf5e79343fe51b002d28814fffc2f110ecf99088a161daed00e908efed7b1f0d

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

module Rugged
  class Tree
    # 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

2 entries across 2 versions & 1 rubygems

Version Path
rugged-0.16.0 lib/rugged/tree.rb
rugged-0.16.0b1 lib/rugged/tree.rb