Class: WordRunDiffLCS::WordRunContextChange
- Inherits:
-
Object
- Object
- WordRunDiffLCS::WordRunContextChange
- Defined in:
- lib/word_run_diff_lcs.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#new_element ⇒ Object
readonly
Returns the value of attribute new_element.
-
#old_element ⇒ Object
readonly
Returns the value of attribute old_element.
Instance Method Summary collapse
-
#initialize(change_context) ⇒ WordRunContextChange
constructor
A new instance of WordRunContextChange.
- #merge!(change_context) ⇒ Object
Constructor Details
#initialize(change_context) ⇒ WordRunContextChange
Returns a new instance of WordRunContextChange.
6 7 8 9 10 |
# File 'lib/word_run_diff_lcs.rb', line 6 def initialize(change_context) @action = change_context.action @old_element = change_context.old_element @new_element = change_context.new_element end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
4 5 6 |
# File 'lib/word_run_diff_lcs.rb', line 4 def action @action end |
#new_element ⇒ Object (readonly)
Returns the value of attribute new_element.
4 5 6 |
# File 'lib/word_run_diff_lcs.rb', line 4 def new_element @new_element end |
#old_element ⇒ Object (readonly)
Returns the value of attribute old_element.
4 5 6 |
# File 'lib/word_run_diff_lcs.rb', line 4 def old_element @old_element end |
Instance Method Details
#merge!(change_context) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/word_run_diff_lcs.rb', line 12 def merge!(change_context) return false unless merge_possible_with?(change_context) @old_element << " #{change_context.old_element}" if change_context.old_element @new_element << " #{change_context.new_element}" if change_context.new_element true end |