Class: Diffed::DiffLine

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ DiffLine

Returns a new instance of DiffLine.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/diffed.rb', line 119

def initialize(line)
  if line.start_with? "-"
    @type = :left
  elsif line.start_with? "+"
    @type = :right
  elsif line.start_with? " "
    @type = :both
  else
    raise "Unparseable line: #{line}"
  end
  
  @text = line
  @no_new_line = false
end

Instance Attribute Details

#no_new_lineObject

Returns the value of attribute no_new_line.



117
118
119
# File 'lib/diffed.rb', line 117

def no_new_line
  @no_new_line
end

#textObject (readonly)

Returns the value of attribute text.



117
118
119
# File 'lib/diffed.rb', line 117

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



117
118
119
# File 'lib/diffed.rb', line 117

def type
  @type
end