Class: Lookout::Difference::String
- Defined in:
- lib/lookout-3.0/difference/string.rb
Overview
Difference reports between Strings.
Instance Attribute Summary
Attributes inherited from Object
Instance Method Summary collapse
-
#diff ⇒ Diff::Formats::Unified, ...
A unified “diff” if Object#actual or Object#expected include a newline, an inline “diff” otherwise, or super if Object#actual isn’t a String.
Methods inherited from Object
#==, #hash, #initialize, #message, #to_s
Constructor Details
This class inherits a constructor from Lookout::Difference::Object
Instance Method Details
#diff ⇒ Diff::Formats::Unified, ...
Returns A unified “diff” if Object#actual or Object#expected include a newline, an inline “diff” otherwise, or super if Object#actual isn’t a String.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lookout-3.0/difference/string.rb', line 8 def diff return super unless String === actual (actual.include? "\n" or expected.include? "\n") ? Lookout::Diff::Formats::Unified. new(Lookout::Diff::Groups. new(Lookout::Diff::Operations. new(Lookout::Diff::Algorithms::Difflib. new(actual.split("\n"), expected.split("\n"))))) : Lookout::Diff::Formats::Inline. new(Lookout::Diff::Operations. new(Lookout::Diff::Algorithms::Difflib. new(actual, expected))) end |