Class: Grit::DiffLine
- Inherits:
-
Struct
- Object
- Struct
- Grit::DiffLine
- Defined in:
- lib/grit/ext/diff_line.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#diff_position ⇒ Object
Returns the value of attribute diff_position.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content
2 3 4 |
# File 'lib/grit/ext/diff_line.rb', line 2 def content @content end |
#diff_position ⇒ Object
Returns the value of attribute diff_position
2 3 4 |
# File 'lib/grit/ext/diff_line.rb', line 2 def diff_position @diff_position end |
#line_number ⇒ Object
Returns the value of attribute line_number
2 3 4 |
# File 'lib/grit/ext/diff_line.rb', line 2 def line_number @line_number end |
#status ⇒ Object
Returns the value of attribute status
2 3 4 |
# File 'lib/grit/ext/diff_line.rb', line 2 def status @status end |
Class Method Details
.status_from_char(char) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/grit/ext/diff_line.rb', line 15 def self.status_from_char(char) case char when '+' then :added when '-' then :removed when ' ' then :unchanged else nil end end |
Instance Method Details
#added? ⇒ Boolean
3 4 5 |
# File 'lib/grit/ext/diff_line.rb', line 3 def added? status == :added end |
#removed? ⇒ Boolean
7 8 9 |
# File 'lib/grit/ext/diff_line.rb', line 7 def removed? status == :removed end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/grit/ext/diff_line.rb', line 25 def to_s "#{char_from_status}#{content}" end |
#unchanged? ⇒ Boolean
11 12 13 |
# File 'lib/grit/ext/diff_line.rb', line 11 def unchanged? status == :unchanged end |