Class: PrettyDiff::Line
- Inherits:
-
Object
- Object
- PrettyDiff::Line
- Defined in:
- lib/pretty_diff/line.rb
Instance Attribute Summary collapse
-
#chunk ⇒ Object
readonly
Returns the value of attribute chunk.
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#left_number ⇒ Object
Returns the value of attribute left_number.
-
#right_number ⇒ Object
Returns the value of attribute right_number.
Instance Method Summary collapse
- #added? ⇒ Boolean
- #deleted? ⇒ Boolean
- #ignored? ⇒ Boolean
-
#initialize(chunk, contents) ⇒ Line
constructor
A new instance of Line.
- #not_modified? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(chunk, contents) ⇒ Line
Returns a new instance of Line.
6 7 8 9 |
# File 'lib/pretty_diff/line.rb', line 6 def initialize(chunk, contents) @chunk = chunk @contents = contents end |
Instance Attribute Details
#chunk ⇒ Object (readonly)
Returns the value of attribute chunk.
3 4 5 |
# File 'lib/pretty_diff/line.rb', line 3 def chunk @chunk end |
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
3 4 5 |
# File 'lib/pretty_diff/line.rb', line 3 def contents @contents end |
#left_number ⇒ Object
Returns the value of attribute left_number.
4 5 6 |
# File 'lib/pretty_diff/line.rb', line 4 def left_number @left_number end |
#right_number ⇒ Object
Returns the value of attribute right_number.
4 5 6 |
# File 'lib/pretty_diff/line.rb', line 4 def right_number @right_number end |
Instance Method Details
#added? ⇒ Boolean
26 27 28 |
# File 'lib/pretty_diff/line.rb', line 26 def added? status == :added end |
#deleted? ⇒ Boolean
30 31 32 |
# File 'lib/pretty_diff/line.rb', line 30 def deleted? status == :deleted end |
#ignored? ⇒ Boolean
11 12 13 |
# File 'lib/pretty_diff/line.rb', line 11 def ignored? contents =~ /\\ No newline at end of file/ end |
#not_modified? ⇒ Boolean
34 35 36 |
# File 'lib/pretty_diff/line.rb', line 34 def not_modified? status == :not_modified end |
#status ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pretty_diff/line.rb', line 15 def status case contents when /^\+/ :added when /^\-/ :deleted else :not_modified end end |