Class: StringDiff::Diff
- Inherits:
-
Object
- Object
- StringDiff::Diff
- Defined in:
- lib/string_diff.rb
Instance Attribute Summary collapse
-
#string1 ⇒ Object
readonly
Returns the value of attribute string1.
-
#string2 ⇒ Object
readonly
Returns the value of attribute string2.
Instance Method Summary collapse
- #diff ⇒ Object
-
#initialize(string1, string2) ⇒ Diff
constructor
A new instance of Diff.
Constructor Details
#initialize(string1, string2) ⇒ Diff
Returns a new instance of Diff.
8 9 10 11 |
# File 'lib/string_diff.rb', line 8 def initialize(string1, string2) @string1 = string1 @string2 = string2 end |
Instance Attribute Details
#string1 ⇒ Object (readonly)
Returns the value of attribute string1.
6 7 8 |
# File 'lib/string_diff.rb', line 6 def string1 @string1 end |
#string2 ⇒ Object (readonly)
Returns the value of attribute string2.
6 7 8 |
# File 'lib/string_diff.rb', line 6 def string2 @string2 end |
Instance Method Details
#diff ⇒ Object
13 14 15 16 17 18 |
# File 'lib/string_diff.rb', line 13 def diff a1 = PragmaticTokenizer::Tokenizer.new(downcase: false).tokenize(string1) a2 = PragmaticTokenizer::Tokenizer.new(downcase: false).tokenize(string2) construct_string(compare(process_parens(a1), process_parens(a2))) end |