Class: PatienceDiff::FormattingContext
- Inherits:
-
Object
- Object
- PatienceDiff::FormattingContext
- Defined in:
- lib/patience_diff/formatting_context.rb
Overview
Delegate object yielded by the #format method.
Instance Method Summary collapse
- #files(left_file, right_file) ⇒ Object
- #format ⇒ Object
-
#initialize(differ, formatter) ⇒ FormattingContext
constructor
A new instance of FormattingContext.
- #names ⇒ Object
- #orphan(sequence, name = nil, timestamp = nil) ⇒ Object
- #sequences(left, right, left_name = nil, right_name = nil, left_timestamp = nil, right_timestamp = nil) ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(differ, formatter) ⇒ FormattingContext
Returns a new instance of FormattingContext.
6 7 8 9 10 |
# File 'lib/patience_diff/formatting_context.rb', line 6 def initialize(differ, formatter) @differ = differ @formatter = formatter @out = StringIO.new end |
Instance Method Details
#files(left_file, right_file) ⇒ Object
12 13 14 |
# File 'lib/patience_diff/formatting_context.rb', line 12 def files(left_file, right_file) @out.print @differ.diff_files(left_file, right_file, @formatter) end |
#format ⇒ Object
24 25 26 |
# File 'lib/patience_diff/formatting_context.rb', line 24 def format @out.string end |
#names ⇒ Object
32 33 34 |
# File 'lib/patience_diff/formatting_context.rb', line 32 def names @formatter.names end |
#orphan(sequence, name = nil, timestamp = nil) ⇒ Object
20 21 22 |
# File 'lib/patience_diff/formatting_context.rb', line 20 def orphan(sequence, name=nil, =nil) @out.print @formatter.render_orphan(sequence, name, ) end |
#sequences(left, right, left_name = nil, right_name = nil, left_timestamp = nil, right_timestamp = nil) ⇒ Object
16 17 18 |
# File 'lib/patience_diff/formatting_context.rb', line 16 def sequences(left, right, left_name=nil, right_name=nil, =nil, =nil) @out.print @differ.diff_sequences(left, right, left_name, right_name, , , @formatter) end |
#title ⇒ Object
28 29 30 |
# File 'lib/patience_diff/formatting_context.rb', line 28 def title @formatter.title end |