Class: Bundler::PubGrub::FailureWriter
- Inherits:
-
Object
- Object
- Bundler::PubGrub::FailureWriter
- Defined in:
- lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb
Instance Method Summary collapse
-
#initialize(root) ⇒ FailureWriter
constructor
A new instance of FailureWriter.
- #write ⇒ Object
Constructor Details
#initialize(root) ⇒ FailureWriter
Returns a new instance of FailureWriter.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb', line 3 def initialize(root) @root = root # { Incompatibility => Integer } @derivations = {} # [ [ String, Integer or nil ] ] @lines = [] # { Incompatibility => Integer } @line_numbers = {} count_derivations(root) end |
Instance Method Details
#write ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb', line 18 def write return @root.to_s unless @root.conflict? visit(@root) padding = @line_numbers.empty? ? 0 : "(#{@line_numbers.values.last}) ".length @lines.map do |, number| next "" if .empty? lead = number ? "(#{number}) " : "" lead = lead.ljust(padding) = .gsub("\n", "\n" + " " * (padding + 2)) "#{lead}#{}" end.join("\n") end |