class Coopy::FlatCellBuilder
Attributes
conflict_separator[RW]
flags[RW]
separator[RW]
view[RW]
protected - in ruby this doesn't play well with static/inline methods
Public Class Methods
new(flags)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 7 def initialize(flags) @flags = flags end
quote_for_diff(v,d)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 53 def FlatCellBuilder.quote_for_diff(v,d) _nil = "NULL" return _nil if v.equals(d,nil) str = v.to_s(d) score = 0 begin _g1 = 0 _g = str.length while(_g1 < _g) i = _g1 _g1+=1 break if (str[score].ord rescue nil) != 95 score+=1 end end str = "_" + _hx_str(str) if str[score..-1] == _nil str end
Public Instance Methods
conflict(parent,local,remote)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 40 def conflict(parent,local,remote) _hx_str(@view.to_s(parent)) + _hx_str(@conflict_separator) + _hx_str(@view.to_s(local)) + _hx_str(@conflict_separator) + _hx_str(@view.to_s(remote)) end
links(unit,row_like)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 48 def links(unit,row_like) return @view.to_datum(unit.to_base26string) if @flags.count_like_a_spreadsheet && !row_like @view.to_datum(unit.to_s) end
marker(label)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 44 def marker(label) @view.to_datum(label) end
need_separator()
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 20 def need_separator true end
set_conflict_separator(separator)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 28 def set_conflict_separator(separator) @conflict_separator = separator end
set_separator(separator)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 24 def set_separator(separator) @separator = separator end
set_view(view)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 32 def set_view(view) @view = view end
update(local,remote)
click to toggle source
# File lib/lib/coopy/flat_cell_builder.rb, line 36 def update(local,remote) @view.to_datum(_hx_str(::Coopy::FlatCellBuilder.quote_for_diff(@view,local)) + _hx_str(@separator) + _hx_str(::Coopy::FlatCellBuilder.quote_for_diff(@view,remote))) end