Class: Diffed::Line

Inherits:
Object
  • Object
show all
Includes:
DiffHtml
Defined in:
lib/models/line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DiffHtml

#as_html_table

Constructor Details

#initialize(type, text, left_line_num, right_line_num) ⇒ Line

Returns a new instance of Line.



8
9
10
# File 'lib/models/line.rb', line 8

def initialize(type, text, left_line_num, right_line_num)
  @type, @text, @left_line_num, @right_line_num, @no_newline = type, text, left_line_num, right_line_num, false
end

Instance Attribute Details

#left_line_numObject (readonly)

Returns the value of attribute left_line_num.



6
7
8
# File 'lib/models/line.rb', line 6

def left_line_num
  @left_line_num
end

#no_newlineObject

Returns the value of attribute no_newline.



6
7
8
# File 'lib/models/line.rb', line 6

def no_newline
  @no_newline
end

#right_line_numObject (readonly)

Returns the value of attribute right_line_num.



6
7
8
# File 'lib/models/line.rb', line 6

def right_line_num
  @right_line_num
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/models/line.rb', line 6

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/models/line.rb', line 6

def type
  @type
end

Instance Method Details

#as_html_row(use_inline_styles, highlight = false) ⇒ Object



25
26
27
# File 'lib/models/line.rb', line 25

def as_html_row(use_inline_styles, highlight = false)
  format_code_line(use_inline_styles, highlight)
end

#left?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/models/line.rb', line 12

def left?
  @type == :left || @type == :both
end

#right?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/models/line.rb', line 16

def right?
  @type == :right || @type == :both
end