Sha256: d99c394246c5ed997a6910611b50555e7036909de4b48ea95087307e9b1ed447

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'scm/commits/commit'

module SCM
  module Commits
    class Git < Commit

      # The parent of the commit
      attr_reader :parent

      # The tree of the commit
      attr_reader :tree

      # The email of the author
      attr_reader :email

      #
      # Creates a new Git commit.
      #
      # @param [String] commit
      #   The SHA1 hash of the commit.
      #
      # @param [String] parent
      #   The SHA1 hash of the parent commit.
      #
      # @param [String] tree
      #   The SHA1 hash of the tree.
      #
      # @param [Time] date
      #   The date the commit was made.
      #
      # @param [String] author
      #   The author of the commit.
      #
      # @param [String] email
      #   The email for the author.
      #
      # @param [String] summary
      #   The summary of the commit.
      #
      def initialize(commit,parent,tree,date,author,email,summary)
        super(commit,date,author,summary)

        @parent = parent
        @tree = tree
        @email = email
      end

      alias sha1 commit

      #
      # Coerces the Git commit into an Array.
      #
      # @return [Array<commit, parent, tree, date, author, email, summary>]
      #   The commit components.
      #
      def to_ary
        [@commit, @parent, @tree, @date, @author, @email, @summary]
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scm-0.1.0.pre1 lib/scm/commits/git.rb