Class: EmailDiff
Constant Summary collapse
- GREATER =
62
Instance Attribute Summary collapse
-
#orig_a ⇒ Object
readonly
Returns the value of attribute orig_a.
-
#orig_b ⇒ Object
readonly
Returns the value of attribute orig_b.
-
#strip_a ⇒ Object
readonly
Returns the value of attribute strip_a.
-
#strip_b ⇒ Object
readonly
Returns the value of attribute strip_b.
Attributes inherited from Diff
Instance Method Summary collapse
-
#initialize(diffs_or_a, b = nil, isstring = nil) ⇒ EmailDiff
constructor
A new instance of EmailDiff.
- #striplines(ary) ⇒ Object
Methods inherited from Diff
#compact, #compact!, #compactdiffs, #discarda, #discardb, #inspect, lcs, #makediff, #match, #to_diff
Constructor Details
#initialize(diffs_or_a, b = nil, isstring = nil) ⇒ EmailDiff
Returns a new instance of EmailDiff.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/emaildiff.rb', line 9 def initialize(diffs_or_a, b = nil, isstring = nil) if b.nil? @diffs = diffs_or_a @isstring = isstring super else @diffs = [] @curdiffs = [] @strip_a = striplines(diffs_or_a) @strip_b = striplines(b) makediff(@strip_a, @strip_b) @orig_a = diffs_or_a @orig_b = b @difftype = diffs_or_a.class end end |
Instance Attribute Details
#orig_a ⇒ Object (readonly)
Returns the value of attribute orig_a.
6 7 8 |
# File 'lib/emaildiff.rb', line 6 def orig_a @orig_a end |
#orig_b ⇒ Object (readonly)
Returns the value of attribute orig_b.
6 7 8 |
# File 'lib/emaildiff.rb', line 6 def orig_b @orig_b end |
#strip_a ⇒ Object (readonly)
Returns the value of attribute strip_a.
7 8 9 |
# File 'lib/emaildiff.rb', line 7 def strip_a @strip_a end |
#strip_b ⇒ Object (readonly)
Returns the value of attribute strip_b.
7 8 9 |
# File 'lib/emaildiff.rb', line 7 def strip_b @strip_b end |
Instance Method Details
#striplines(ary) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/emaildiff.rb', line 26 def striplines(ary) newary= ary.dup newary.each_with_index { |item,index| if item.class == String item = item.dup item = item.strip while item[0,1] == ">" item.slice!(0) item = item.strip end newary[index] = item end } return newary end |