Class: Git::Diff::DiffFile
- Inherits:
-
Object
- Object
- Git::Diff::DiffFile
- Defined in:
- lib/git/diff.rb
Instance Attribute Summary collapse
-
#dst ⇒ Object
Returns the value of attribute dst.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#patch ⇒ Object
Returns the value of attribute patch.
-
#path ⇒ Object
Returns the value of attribute path.
-
#src ⇒ Object
Returns the value of attribute src.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #binary? ⇒ Boolean
- #blob(type = :dst) ⇒ Object
-
#initialize(base, hash) ⇒ DiffFile
constructor
A new instance of DiffFile.
Constructor Details
#initialize(base, hash) ⇒ DiffFile
Returns a new instance of DiffFile.
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/git/diff.rb', line 72 def initialize(base, hash) @base = base @patch = hash[:patch] @path = hash[:path] @mode = hash[:mode] @src = hash[:src] @dst = hash[:dst] @type = hash[:type] @binary = hash[:binary] end |
Instance Attribute Details
#dst ⇒ Object
Returns the value of attribute dst.
69 70 71 |
# File 'lib/git/diff.rb', line 69 def dst @dst end |
#mode ⇒ Object
Returns the value of attribute mode.
69 70 71 |
# File 'lib/git/diff.rb', line 69 def mode @mode end |
#patch ⇒ Object
Returns the value of attribute patch.
69 70 71 |
# File 'lib/git/diff.rb', line 69 def patch @patch end |
#path ⇒ Object
Returns the value of attribute path.
69 70 71 |
# File 'lib/git/diff.rb', line 69 def path @path end |
#src ⇒ Object
Returns the value of attribute src.
69 70 71 |
# File 'lib/git/diff.rb', line 69 def src @src end |
#type ⇒ Object
Returns the value of attribute type.
69 70 71 |
# File 'lib/git/diff.rb', line 69 def type @type end |
Instance Method Details
#binary? ⇒ Boolean
83 84 85 |
# File 'lib/git/diff.rb', line 83 def binary? !!@binary end |
#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 |