Class: Diffed::DiffLine
- Inherits:
-
Object
- Object
- Diffed::DiffLine
- Defined in:
- lib/diffed.rb
Instance Attribute Summary collapse
-
#no_new_line ⇒ Object
Returns the value of attribute no_new_line.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(line) ⇒ DiffLine
constructor
A new instance of DiffLine.
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_line ⇒ Object
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 |
#text ⇒ Object (readonly)
Returns the value of attribute text.
117 118 119 |
# File 'lib/diffed.rb', line 117 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
117 118 119 |
# File 'lib/diffed.rb', line 117 def type @type end |