Class: Coopy::Change
- Inherits:
-
Object
- Object
- Coopy::Change
- Defined in:
- lib/lib/coopy/change.rb
Instance Attribute Summary collapse
-
#change ⇒ Object
Returns the value of attribute change.
-
#local ⇒ Object
Returns the value of attribute local.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#remote ⇒ Object
Returns the value of attribute remote.
Instance Method Summary collapse
- #get_mode ⇒ Object
-
#initialize(txt = nil) ⇒ Change
constructor
A new instance of Change.
- #to_s ⇒ Object
Constructor Details
#initialize(txt = nil) ⇒ Change
Returns a new instance of Change.
7 8 9 10 11 12 13 14 |
# File 'lib/lib/coopy/change.rb', line 7 def initialize(txt = nil) if txt != nil @mode = ::Coopy::ChangeType.note_change @change = txt else @mode = ::Coopy::ChangeType.no_change end end |
Instance Attribute Details
#change ⇒ Object
Returns the value of attribute change.
16 17 18 |
# File 'lib/lib/coopy/change.rb', line 16 def change @change end |
#local ⇒ Object
Returns the value of attribute local.
18 19 20 |
# File 'lib/lib/coopy/change.rb', line 18 def local @local end |
#mode ⇒ Object
Returns the value of attribute mode.
20 21 22 |
# File 'lib/lib/coopy/change.rb', line 20 def mode @mode end |
#parent ⇒ Object
Returns the value of attribute parent.
17 18 19 |
# File 'lib/lib/coopy/change.rb', line 17 def parent @parent end |
#remote ⇒ Object
Returns the value of attribute remote.
19 20 21 |
# File 'lib/lib/coopy/change.rb', line 19 def remote @remote end |
Instance Method Details
#get_mode ⇒ Object
22 23 24 |
# File 'lib/lib/coopy/change.rb', line 22 def get_mode return "" + _hx_str(@mode.to_s) end |
#to_s ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lib/coopy/change.rb', line 26 def to_s begin _g = @mode case(_g.index) when 0 return "no change" when 2 return "local change: " + _hx_str(@remote.to_s) + " -> " + _hx_str(@local.to_s) when 1 return "remote change: " + _hx_str(@local.to_s) + " -> " + _hx_str(@remote.to_s) when 3 return "conflicting change: " + _hx_str(@parent.to_s) + " -> " + _hx_str(@local.to_s) + " / " + _hx_str(@remote.to_s) when 4 return "same change: " + _hx_str(@parent.to_s) + " -> " + _hx_str(@local.to_s) + " / " + _hx_str(@remote.to_s) when 5 return @change end end end |