Class: GitReviewer::DiffLine
- Inherits:
-
Object
- Object
- GitReviewer::DiffLine
- Defined in:
- lib/gitreviewer/analyze/diff_tree.rb
Constant Summary collapse
- UNCHANGE =
未变化
0- DELETE =
删除行
1- ADD =
新增行
2
Instance Attribute Summary collapse
-
#operation ⇒ Object
Returns the value of attribute operation.
-
#source_line ⇒ Object
对于 UNCHANGE 操作,sLine 有值,tLine 有值 对于 DELETE 操作,sLine 有值,tLine 无值 对于 ADD 操作,sLine 无值,tLine 有值.
-
#target_line ⇒ Object
目标行, BlameLine.
Instance Method Summary collapse
- #format_user ⇒ Object
-
#initialize(source_line, target_line, operation) ⇒ DiffLine
constructor
A new instance of DiffLine.
- #is_unchange ⇒ Object
- #s_line_number ⇒ Object
- #t_line_number ⇒ Object
Constructor Details
#initialize(source_line, target_line, operation) ⇒ DiffLine
126 127 128 129 130 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 126 def initialize(source_line, target_line, operation) @source_line = source_line @target_line = target_line @operation = operation end |
Instance Attribute Details
#operation ⇒ Object
Returns the value of attribute operation.
124 125 126 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 124 def operation @operation end |
#source_line ⇒ Object
对于 UNCHANGE 操作,sLine 有值,tLine 有值对于 DELETE 操作,sLine 有值,tLine 无值对于 ADD 操作,sLine 无值,tLine 有值
122 123 124 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 122 def source_line @source_line end |
#target_line ⇒ Object
目标行, BlameLine
123 124 125 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 123 def target_line @target_line end |
Instance Method Details
#format_user ⇒ Object
144 145 146 147 148 149 150 151 152 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 144 def format_user if operation == DiffLine::DELETE return source_line.user elsif operation == DiffLine::ADD return target_line.user else return source_line.user end end |
#is_unchange ⇒ Object
132 133 134 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 132 def is_unchange operation == UNCHANGE end |
#s_line_number ⇒ Object
136 137 138 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 136 def s_line_number source_line.line end |
#t_line_number ⇒ Object
140 141 142 |
# File 'lib/gitreviewer/analyze/diff_tree.rb', line 140 def t_line_number target_line.line end |