class MetaCommit::Models::Changes::Commit
Collection of file changes @attr [Symbol] old_commit_id
@attr [Symbol] new_commit_id
@attr [Array<MetaCommit::Contracts::Diff>] file_changes
Attributes
file_changes[RW]
new_commit_id[RW]
old_commit_id[RW]
Public Class Methods
new(old_commit_id, new_commit_id)
click to toggle source
@param [Symbol] old_commit_id
@param [Symbol] new_commit_id
# File lib/meta_commit/models/changes/commit.rb, line 11 def initialize(old_commit_id, new_commit_id) @old_commit_id = old_commit_id @new_commit_id = new_commit_id @file_changes = [] end
Public Instance Methods
commit_id()
click to toggle source
@return [String]
# File lib/meta_commit/models/changes/commit.rb, line 28 def commit_id if @old_commit_id == @new_commit_id @new_commit_id else "#{@old_commit_id} -> #{@new_commit_id}" end end
each(&block)
click to toggle source
@yield file changes
# File lib/meta_commit/models/changes/commit.rb, line 37 def each(&block) @file_changes.each(&block) end
empty?()
click to toggle source
@return [Boolean]
# File lib/meta_commit/models/changes/commit.rb, line 42 def empty? @file_changes.empty? end
include?(change)
click to toggle source
@return [Boolean]
# File lib/meta_commit/models/changes/commit.rb, line 47 def include?(change) @file_changes.include?(change) end
push(file_change)
click to toggle source
@param [MetaCommit::Contracts::Diff] file_change
# File lib/meta_commit/models/changes/commit.rb, line 18 def push(file_change) @file_changes.push(file_change) end
push_changes(file_changes)
click to toggle source
@param [Array<MetaCommit::Contracts::Diff>] file_changes
# File lib/meta_commit/models/changes/commit.rb, line 23 def push_changes(file_changes) @file_changes+=file_changes end