class Bundler::PubGrub::FailureWriter
Public Class Methods
new(root)
click to toggle source
# File 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
Public Instance Methods
write()
click to toggle source
# File 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 |message, number| next "" if message.empty? lead = number ? "(#{number}) " : "" lead = lead.ljust(padding) message = message.gsub("\n", "\n" + " " * (padding + 2)) "#{lead}#{message}" end.join("\n") end