Sha256: f1c33664f9436af69179addf11eee52da4d421fb886fa502c4ef493cbc0225a1

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

module SCM
  module Commits
    #
    # Base-class for other SCM Commit classes.
    #
    class Commit

      # The commit hash or revision number
      attr_reader :commit

      # The date of the commit
      attr_reader :date

      # The author of the commit
      attr_reader :author

      # The summary of the commit
      attr_reader :summary

      #
      # Creates a new commit object.
      #
      # @param [String, Integer] commit
      #   The commit hash or revision number.
      #
      # @param [Time] date
      #   The date of the commit.
      #
      # @param [String] author
      #   The author of the commit.
      #
      # @param [String] summary
      #   The summary of the commit.
      #
      def initialize(commit,date,author,summary)
        @commit = commit
        @date = date
        @author = author
        @summary = summary
      end

      #
      # Converts the commit to a String.
      #
      # @return [String]
      #   The commit hash or revision.
      #
      def to_s
        @commit.to_s
      end

      #
      # Coerces the commit into an Array.
      #
      # @return [Array<commit, date, author, summary>]
      #   The commit components.
      #
      def to_ary
        [@commit, @date, @author, @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/commit.rb