Class: Redmine::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/unified_diff.rb

Overview

A line of diff

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDiff



209
210
211
212
213
214
215
216
# File 'lib/redmine/unified_diff.rb', line 209

def initialize()
  self.nb_line_left = ''
  self.nb_line_right = ''
  self.line_left = ''
  self.line_right = ''
  self.type_diff_right = ''
  self.type_diff_left = ''
end

Instance Attribute Details

#line_leftObject

Returns the value of attribute line_left



202
203
204
# File 'lib/redmine/unified_diff.rb', line 202

def line_left
  @line_left
end

#line_rightObject

Returns the value of attribute line_right



204
205
206
# File 'lib/redmine/unified_diff.rb', line 204

def line_right
  @line_right
end

#nb_line_leftObject

Returns the value of attribute nb_line_left



201
202
203
# File 'lib/redmine/unified_diff.rb', line 201

def nb_line_left
  @nb_line_left
end

#nb_line_rightObject

Returns the value of attribute nb_line_right



203
204
205
# File 'lib/redmine/unified_diff.rb', line 203

def nb_line_right
  @nb_line_right
end

#offsetsObject

Returns the value of attribute offsets



207
208
209
# File 'lib/redmine/unified_diff.rb', line 207

def offsets
  @offsets
end

#type_diff_leftObject

Returns the value of attribute type_diff_left



206
207
208
# File 'lib/redmine/unified_diff.rb', line 206

def type_diff_left
  @type_diff_left
end

#type_diff_rightObject

Returns the value of attribute type_diff_right



205
206
207
# File 'lib/redmine/unified_diff.rb', line 205

def type_diff_right
  @type_diff_right
end

Instance Method Details

#html_lineObject



242
243
244
245
246
247
248
# File 'lib/redmine/unified_diff.rb', line 242

def html_line
  if offsets
    line.dup.insert(offsets.first, '<span>').insert(offsets.last, '</span>')
  else
    line
  end
end

#html_line_leftObject



226
227
228
229
230
231
232
# File 'lib/redmine/unified_diff.rb', line 226

def html_line_left
  if offsets
    line_left.dup.insert(offsets.first, '<span>').insert(offsets.last, '</span>')
  else
    line_left
  end
end

#html_line_rightObject



234
235
236
237
238
239
240
# File 'lib/redmine/unified_diff.rb', line 234

def html_line_right
  if offsets
    line_right.dup.insert(offsets.first, '<span>').insert(offsets.last, '</span>')
  else
    line_right
  end
end

#inspectObject



250
251
252
253
254
255
256
# File 'lib/redmine/unified_diff.rb', line 250

def inspect
  puts '### Start Line Diff ###'
  puts self.nb_line_left
  puts self.line_left
  puts self.nb_line_right
  puts self.line_right
end

#lineObject



222
223
224
# File 'lib/redmine/unified_diff.rb', line 222

def line
  type_diff_right == 'diff_in' ? line_right : line_left
end

#type_diffObject



218
219
220
# File 'lib/redmine/unified_diff.rb', line 218

def type_diff
  type_diff_right == 'diff_in' ? type_diff_right : type_diff_left
end