Class: SpecViews::BatchDiff::Change
- Inherits:
-
Struct
- Object
- Struct
- SpecViews::BatchDiff::Change
- Defined in:
- app/models/spec_views/batch_diff.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
- #accept! ⇒ Object
- #add(directory, diff) ⇒ Object
- #champion ⇒ Object
- #diff ⇒ Object
- #directory ⇒ Object
- #patched_champion ⇒ Object
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count
7 8 9 |
# File 'app/models/spec_views/batch_diff.rb', line 7 def count @count end |
#hash ⇒ Object
Returns the value of attribute hash
7 8 9 |
# File 'app/models/spec_views/batch_diff.rb', line 7 def hash @hash end |
Instance Method Details
#accept! ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/models/spec_views/batch_diff.rb', line 30 def accept! @pairs.each do |directory, diff| patched_champion = Diff::LCS.patch!(directory.champion_html, diff) directory.write_champion(patched_champion) directory.remove_challenger if patched_champion == directory.challenger_html end end |
#add(directory, diff) ⇒ Object
16 17 18 19 20 |
# File 'app/models/spec_views/batch_diff.rb', line 16 def add(directory, diff) @pairs ||= [] @pairs.push([directory, diff]) self.count += 1 end |
#champion ⇒ Object
12 13 14 |
# File 'app/models/spec_views/batch_diff.rb', line 12 def champion directory.champion_html end |
#diff ⇒ Object
26 27 28 |
# File 'app/models/spec_views/batch_diff.rb', line 26 def diff @pairs&.first&.second end |
#directory ⇒ Object
22 23 24 |
# File 'app/models/spec_views/batch_diff.rb', line 22 def directory @pairs&.first&.first end |
#patched_champion ⇒ Object
8 9 10 |
# File 'app/models/spec_views/batch_diff.rb', line 8 def patched_champion Diff::LCS.patch!(champion, diff) end |