Sha256: 703277b7899319ee2880438f6cd30e08447aac2f94cf1ca52462ea77b28871c1

Contents?: true

Size: 425 Bytes

Versions: 1

Compression:

Stored size: 425 Bytes

Contents

module Cryptosphere
  class Tree < Blob
    def self.[](*entries)
      new(entries)
    end

    def initialize(entries)
      @entries = entries
    end

    def to_s
      @entries.sort_by { |e| e.name }.map(&:to_s).join("\n")
    end

    # Individual entries in a tree
    class Entry < Struct.new(:mode, :type, :id, :key, :name)
      def to_s
        "#{mode} #{type} #{id} #{key} #{name}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cryptosphere-0.0.0 lib/cryptosphere/blobs/tree.rb