Class: Coopy::FlatCellBuilder
- Inherits:
-
Object
- Object
- Coopy::FlatCellBuilder
- Defined in:
- lib/lib/coopy/flat_cell_builder.rb
Instance Attribute Summary collapse
-
#conflict_separator ⇒ Object
Returns the value of attribute conflict_separator.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#separator ⇒ Object
Returns the value of attribute separator.
-
#view ⇒ Object
protected - in ruby this doesn’t play well with static/inline methods.
Class Method Summary collapse
Instance Method Summary collapse
- #conflict(parent, local, remote) ⇒ Object
-
#initialize(flags) ⇒ FlatCellBuilder
constructor
A new instance of FlatCellBuilder.
- #links(unit, row_like) ⇒ Object
- #marker(label) ⇒ Object
- #need_separator ⇒ Object
- #set_conflict_separator(separator) ⇒ Object
- #set_separator(separator) ⇒ Object
- #set_view(view) ⇒ Object
- #update(local, remote) ⇒ Object
Constructor Details
#initialize(flags) ⇒ FlatCellBuilder
Returns a new instance of FlatCellBuilder.
7 8 9 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 7 def initialize(flags) @flags = flags end |
Instance Attribute Details
#conflict_separator ⇒ Object
Returns the value of attribute conflict_separator.
15 16 17 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 15 def conflict_separator @conflict_separator end |
#flags ⇒ Object
Returns the value of attribute flags.
16 17 18 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 16 def flags @flags end |
#separator ⇒ Object
Returns the value of attribute separator.
14 15 16 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 14 def separator @separator end |
#view ⇒ Object
protected - in ruby this doesn’t play well with static/inline methods
13 14 15 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 13 def view @view end |
Class Method Details
.quote_for_diff(v, d) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# 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 |
Instance Method Details
#conflict(parent, local, remote) ⇒ Object
40 41 42 |
# 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) ⇒ Object
48 49 50 51 |
# 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) ⇒ Object
44 45 46 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 44 def marker(label) @view.to_datum(label) end |
#need_separator ⇒ Object
20 21 22 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 20 def need_separator true end |
#set_conflict_separator(separator) ⇒ Object
28 29 30 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 28 def set_conflict_separator(separator) @conflict_separator = separator end |
#set_separator(separator) ⇒ Object
24 25 26 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 24 def set_separator(separator) @separator = separator end |
#set_view(view) ⇒ Object
32 33 34 |
# File 'lib/lib/coopy/flat_cell_builder.rb', line 32 def set_view(view) @view = view end |
#update(local, remote) ⇒ Object
36 37 38 |
# 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 |