Class String
In: lib/expectations/string.rb
Parent: Object

Methods

diff  

Public Instance methods

[Source]

    # File lib/expectations/string.rb, line 2
 2:   def diff(other)
 3:     (0..self.size).inject("") do |result, index|
 4:       if self[index, 1] == other[index, 1]
 5:         result += self[index, 1]
 6:       else
 7:         result += "[#{self[index, 1]}|#{other[index, 1]}], mismatch at index #{index}\n"
 8:         result += "trailing expected: <#{self[index+1, self.size - index]}>\n"
 9:         result += "trailing actual: <#{other[index+1, other.size - index]}>"
10:         return result
11:       end
12:       result
13:     end
14:   end

[Validate]