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) ⇒ HighlightPatch
constructor
A new instance of HighlightPatch.
- #reset ⇒ Object
Constructor Details
#initialize(source, patch) ⇒ HighlightPatch
Returns a new instance of HighlightPatch.
7 8 9 10 11 |
# File 'lib/lib/coopy/highlight_patch.rb', line 7 def initialize(source,patch) @source = source @patch = patch @view = patch.get_cell_view end |
Instance Method Details
#apply ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/lib/coopy/highlight_patch.rb', line 73 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 begin _g11 = 0 _g2 = @patch.get_height while(_g11 < _g2) r1 = _g11 _g11+=1 self.apply_row(r1) end end self.finish_rows self.finish_columns return true end |
#get_row_string(c) ⇒ Object
292 293 294 295 296 |
# File 'lib/lib/coopy/highlight_patch.rb', line 292 def get_row_string(c) at = @source_in_patch_col[c] return "NOT_FOUND" if at == nil return self.get_pre_string(self.get_string(at)) end |
#reset ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/lib/coopy/highlight_patch.rb', line 47 def reset @header = {} @header_pre = {} @header_post = {} @header_rename = {} @header_move = nil @modifier = {} @mods = Array.new @cmods = Array.new @csv = ::Coopy::Csv.new @rc_offset = 0 @current_row = -1 @row_info = ::Coopy::CellInfo.new @cell_info = ::Coopy::CellInfo.new @source_in_patch_col = @patch_in_source_col = nil @patch_in_source_row = {} @indexes = nil @last_source_row = -1 @actions = Array.new @row_permutation = nil @row_permutation_rev = nil @col_permutation = nil @col_permutation_rev = nil @have_dropped_columns = false end |