Class: SK::SDK::Sync::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/sk_sdk/sync.rb

Overview

A Sync::Field holds the local(left) and remote(right) field name and if available the transfer methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Field

Create a new sync field. The local and remote name MUST be set. Transition methods are optional.

Examples:

no transition methods:

opts = [:local_name, :remote_name]
fld = Field.new opts

with transition method:

opts = [:local_name, :remote_name, "AClass.local_transition", "AClass.remote_transition"]
fld = Field.new opts

Parameters:

  • opts (Array<String, Symbol>)


152
153
154
155
156
157
158
# File 'lib/sk_sdk/sync.rb', line 152

def initialize(opts)
  if opts.is_a? Array
    @l_trans, @r_trans = opts[2], opts[3] if opts.length == 4
    @l_name = opts[0]
    @r_name = opts[1]
  end
end

Instance Attribute Details

#l_nameObject (readonly)

Returns the value of attribute l_name.



139
140
141
# File 'lib/sk_sdk/sync.rb', line 139

def l_name
  @l_name
end

#l_transObject (readonly)

Returns the value of attribute l_trans.



139
140
141
# File 'lib/sk_sdk/sync.rb', line 139

def l_trans
  @l_trans
end

#r_nameObject (readonly)

Returns the value of attribute r_name.



139
140
141
# File 'lib/sk_sdk/sync.rb', line 139

def r_name
  @r_name
end

#r_transObject (readonly)

Returns the value of attribute r_trans.



139
140
141
# File 'lib/sk_sdk/sync.rb', line 139

def r_trans
  @r_trans
end

Instance Method Details

#transition?Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/sk_sdk/sync.rb', line 160

def transition?
  @l_trans && @r_trans
end