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

Returns a new instance of Diff.


238
239
240
241
242
243
244
245
# File 'lib/redmine/unified_diff.rb', line 238

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


231
232
233
# File 'lib/redmine/unified_diff.rb', line 231

def line_left
  @line_left
end

#line_rightObject

Returns the value of attribute line_right


233
234
235
# File 'lib/redmine/unified_diff.rb', line 233

def line_right
  @line_right
end

#nb_line_leftObject

Returns the value of attribute nb_line_left


230
231
232
# File 'lib/redmine/unified_diff.rb', line 230

def nb_line_left
  @nb_line_left
end

#nb_line_rightObject

Returns the value of attribute nb_line_right


232
233
234
# File 'lib/redmine/unified_diff.rb', line 232

def nb_line_right
  @nb_line_right
end

#offsetsObject

Returns the value of attribute offsets


236
237
238
# File 'lib/redmine/unified_diff.rb', line 236

def offsets
  @offsets
end

#type_diff_leftObject

Returns the value of attribute type_diff_left


235
236
237
# File 'lib/redmine/unified_diff.rb', line 235

def type_diff_left
  @type_diff_left
end

#type_diff_rightObject

Returns the value of attribute type_diff_right


234
235
236
# File 'lib/redmine/unified_diff.rb', line 234

def type_diff_right
  @type_diff_right
end

Instance Method Details

#html_lineObject


263
264
265
# File 'lib/redmine/unified_diff.rb', line 263

def html_line
  line_to_html(line, offsets)
end

#html_line_leftObject


255
256
257
# File 'lib/redmine/unified_diff.rb', line 255

def html_line_left
  line_to_html(line_left, offsets)
end

#html_line_rightObject


259
260
261
# File 'lib/redmine/unified_diff.rb', line 259

def html_line_right
  line_to_html(line_right, offsets)
end

#inspectObject


267
268
269
270
271
272
273
# File 'lib/redmine/unified_diff.rb', line 267

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


251
252
253
# File 'lib/redmine/unified_diff.rb', line 251

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

#type_diffObject


247
248
249
# File 'lib/redmine/unified_diff.rb', line 247

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