Sha256: 643e31b43808aa3f43346fb819eac8c42b1c82f0206236b5e8fb26634776e5b5

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

module Rugged
  class Commit

    def inspect
      "#<Rugged::Commit:#{object_id} {message: #{message.inspect}, tree: #{tree.inspect}, parents: #{parent_ids}>"
    end

    # The time when this commit was made effective. This is the same value
    # as the +:time+ attribute for +commit.committer+.
    #
    # Returns a Time object
    def time
      @time ||= Time.at(self.epoch_time)
    end

    def to_hash
      {
        :message => message,
        :committer => committer,
        :author => author,
        :tree => tree,
        :parents => parents,
      }
    end
    
    def parent_ids
      parents.map { |parent| parent.oid }
    end

    def modify(new_args, update_ref=nil)
      args = self.to_hash.merge(new_args)
      Commit.create(args, update_ref)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rugged-0.17.0.b6 lib/rugged/commit.rb
rugged-0.17.0b1 lib/rugged/commit.rb