Class: ReaPack::Index::Git::Diff
- Inherits:
-
Object
- Object
- ReaPack::Index::Git::Diff
- Defined in:
- lib/reapack/index/git.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #file ⇒ Object
-
#initialize(delta, repo) ⇒ Diff
constructor
A new instance of Diff.
- #new_content ⇒ Object
- #new_header ⇒ Object
Constructor Details
#initialize(delta, repo) ⇒ Diff
Returns a new instance of Diff.
210 211 212 213 214 215 |
# File 'lib/reapack/index/git.rb', line 210 def initialize(delta, repo) @delta, @repo = delta, repo @status = delta.status.to_sym @file = delta.new_file end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
217 218 219 |
# File 'lib/reapack/index/git.rb', line 217 def status @status end |
Instance Method Details
#file ⇒ Object
219 220 221 |
# File 'lib/reapack/index/git.rb', line 219 def file @path ||= @file[:path].force_encoding(Encoding::UTF_8) end |
#new_content ⇒ Object
223 224 225 226 227 |
# File 'lib/reapack/index/git.rb', line 223 def new_content return if status == :deleted @new_content ||= @repo.lookup(@file[:oid]).content.force_encoding(Encoding::UTF_8) end |