Class: Coopy::HighlightPatch
- Inherits:
-
Object
- Object
- Coopy::HighlightPatch
- Defined in:
- lib/lib/coopy/highlight_patch.rb
Instance Method Summary collapse
- #apply ⇒ Object
- #get_row_string(c) ⇒ Object
-
#initialize(source, patch, flags = nil) ⇒ HighlightPatch
constructor
A new instance of HighlightPatch.
- #is_preamble ⇒ Object
Constructor Details
#initialize(source, patch, flags = nil) ⇒ HighlightPatch
Returns a new instance of HighlightPatch.
7 8 9 10 11 12 13 14 15 |
# File 'lib/lib/coopy/highlight_patch.rb', line 7 def initialize(source,patch,flags = nil) @source = source @patch = patch @flags = flags @flags = ::Coopy::CompareFlags.new if flags == nil @view = patch.get_cell_view @source_view = source.get_cell_view = source. end |
Instance Method Details
#apply ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/lib/coopy/highlight_patch.rb', line 100 def apply self.reset return true if @patch.get_width < 2 return true if @patch.get_height < 1 @payload_col = 1 + @rc_offset @payload_top = @patch.get_width corner = @patch.get_cell_view.to_s(@patch.get_cell(0,0)) if corner == "@:@" @rc_offset = 1 else @rc_offset = 0 end begin _g1 = 0 _g = @patch.get_height while(_g1 < _g) r = _g1 _g1+=1 str = @view.to_s(@patch.get_cell(@rc_offset,r)) @actions.push(((str != nil) ? str : "")) end end @preamble_row = @header_row = @rc_offset begin _g11 = 0 _g2 = @patch.get_height while(_g11 < _g2) r1 = _g11 _g11+=1 self.apply_row(r1) end end self.finish_columns self.finish_rows true end |
#get_row_string(c) ⇒ Object
514 515 516 517 518 |
# File 'lib/lib/coopy/highlight_patch.rb', line 514 def get_row_string(c) at = @source_in_patch_col[c] return "NOT_FOUND" if at == nil self.get_pre_string(self.get_string(at)) end |
#is_preamble ⇒ Object
520 521 522 |
# File 'lib/lib/coopy/highlight_patch.rb', line 520 def is_preamble @current_row <= @preamble_row end |