Class: Mercurial::Diff
- Inherits:
-
Object
- Object
- Mercurial::Diff
- Defined in:
- lib/mercurial-ruby/diff.rb
Overview
The class represents Mercurial diff. Obtained by running an hg diff command.
The class represents Diff object itself, DiffFactory is responsible for assembling instances of Diff. For the list of all possible diff-related operations please look documentation for DiffFactory.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Diff body.
-
#file_a ⇒ Object
readonly
Version a if the file name.
-
#file_b ⇒ Object
readonly
Version b of the file name.
-
#hash_a ⇒ Object
readonly
SHA1 hash of version a of the file.
-
#hash_b ⇒ Object
readonly
SHA1 hash of version b of the file.
Instance Method Summary collapse
- #binary? ⇒ Boolean
- #file_name ⇒ Object
-
#initialize(opts = {}) ⇒ Diff
constructor
A new instance of Diff.
Constructor Details
#initialize(opts = {}) ⇒ Diff
Returns a new instance of Diff.
27 28 29 30 31 32 33 34 |
# File 'lib/mercurial-ruby/diff.rb', line 27 def initialize(opts={}) @hash_a = opts[:hash_a] @hash_b = opts[:hash_b] @file_a = opts[:file_a] @file_b = opts[:file_b] @body = opts[:body] @binary = opts[:binary] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Diff body.
25 26 27 |
# File 'lib/mercurial-ruby/diff.rb', line 25 def body @body end |
#file_a ⇒ Object (readonly)
Version a if the file name.
19 20 21 |
# File 'lib/mercurial-ruby/diff.rb', line 19 def file_a @file_a end |
#file_b ⇒ Object (readonly)
Version b of the file name.
22 23 24 |
# File 'lib/mercurial-ruby/diff.rb', line 22 def file_b @file_b end |
#hash_a ⇒ Object (readonly)
SHA1 hash of version a of the file.
13 14 15 |
# File 'lib/mercurial-ruby/diff.rb', line 13 def hash_a @hash_a end |
#hash_b ⇒ Object (readonly)
SHA1 hash of version b of the file.
16 17 18 |
# File 'lib/mercurial-ruby/diff.rb', line 16 def hash_b @hash_b end |
Instance Method Details
#binary? ⇒ Boolean
40 41 42 |
# File 'lib/mercurial-ruby/diff.rb', line 40 def binary? !! @binary end |
#file_name ⇒ Object
36 37 38 |
# File 'lib/mercurial-ruby/diff.rb', line 36 def file_name file_b || file_a end |