Class: Gitlab::WordDiff::Segments::Chunk
- Inherits:
-
Object
- Object
- Gitlab::WordDiff::Segments::Chunk
- Defined in:
- lib/gitlab/word_diff/segments/chunk.rb
Instance Method Summary collapse
- #added? ⇒ Boolean
-
#initialize(line) ⇒ Chunk
constructor
A new instance of Chunk.
- #length ⇒ Object
- #removed? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(line) ⇒ Chunk
Returns a new instance of Chunk.
10 11 12 |
# File 'lib/gitlab/word_diff/segments/chunk.rb', line 10 def initialize(line) @line = line end |
Instance Method Details
#added? ⇒ Boolean
18 19 20 |
# File 'lib/gitlab/word_diff/segments/chunk.rb', line 18 def added? line[0] == '+' end |
#length ⇒ Object
26 27 28 |
# File 'lib/gitlab/word_diff/segments/chunk.rb', line 26 def length to_s.length end |
#removed? ⇒ Boolean
14 15 16 |
# File 'lib/gitlab/word_diff/segments/chunk.rb', line 14 def removed? line[0] == '-' end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/gitlab/word_diff/segments/chunk.rb', line 22 def to_s line[1..] || '' end |