Class: Git::Diff::DiffFile

Inherits:
Object
  • Object
show all
Defined in:
lib/git/diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, hash) ⇒ DiffFile

Returns a new instance of DiffFile.



77
78
79
80
81
82
83
84
85
# File 'lib/git/diff.rb', line 77

def initialize(base, hash)
  @base = base
  @patch = hash[:patch]
  @path = hash[:path]
  @mode = hash[:mode]
  @src = hash[:src]
  @dst = hash[:dst]
  @type = hash[:type]
end

Instance Attribute Details

#dstObject

Returns the value of attribute dst.



74
75
76
# File 'lib/git/diff.rb', line 74

def dst
  @dst
end

#modeObject

Returns the value of attribute mode.



74
75
76
# File 'lib/git/diff.rb', line 74

def mode
  @mode
end

#patchObject

Returns the value of attribute patch.



74
75
76
# File 'lib/git/diff.rb', line 74

def patch
  @patch
end

#pathObject

Returns the value of attribute path.



74
75
76
# File 'lib/git/diff.rb', line 74

def path
  @path
end

#srcObject

Returns the value of attribute src.



74
75
76
# File 'lib/git/diff.rb', line 74

def src
  @src
end

#typeObject

Returns the value of attribute type.



74
75
76
# File 'lib/git/diff.rb', line 74

def type
  @type
end

Instance Method Details

#blob(type = :dst) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/git/diff.rb', line 87

def blob(type = :dst)
  if type == :src
    @base.object(@src) if @src != '0000000'
  else
    @base.object(@dst) if @dst != '0000000'
  end
end