Class: Diffed::Line

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Line.



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

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.



3
4
5
# File 'lib/models/line.rb', line 3

def left_line_num
  @left_line_num
end

#no_newlineObject

Returns the value of attribute no_newline.



3
4
5
# File 'lib/models/line.rb', line 3

def no_newline
  @no_newline
end

#right_line_numObject (readonly)

Returns the value of attribute right_line_num.



3
4
5
# File 'lib/models/line.rb', line 3

def right_line_num
  @right_line_num
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/models/line.rb', line 3

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/models/line.rb', line 3

def type
  @type
end

Instance Method Details

#left?Boolean

Returns:

  • (Boolean)


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

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

#right?Boolean

Returns:

  • (Boolean)


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

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