Class: TECSCDE::TmObject

Inherits:
Object show all
Defined in:
lib/tecscde/tm_object.rb

Overview

TmObject: base class for TECSModel & its children

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ownerObject

@owner

TmRegion => TmRegion, TECSModel(for root region) TmCell => TmRegion TmPort => TmCell | TmCPortArray | TmEPortArray TmJoin => TECSModel TmJoinBar => TmJoin TECSModel => Nil



62
63
64
# File 'lib/tecscde/tm_object.rb', line 62

def owner
  @owner
end

Instance Method Details

#copy_from(tm_object) ⇒ Object



80
81
82
83
84
85
86
87
88
89
# File 'lib/tecscde/tm_object.rb', line 80

def copy_from(tm_object)
  tm_object.instance_variables.each do |iv|
    val = tm_object.instance_variable_get(iv)
    if val.is_a?(Array) || val.is_a?(Hash)
      instance_variable_set(iv, val.dup)
    else
      instance_variable_set(iv, val)
    end
  end
end

#modelObject



64
65
66
67
68
69
70
71
72
73
# File 'lib/tecscde/tm_object.rb', line 64

def model
  if @owner
    @owner.model
  else
    if is_a?(TECSModel)
      raise "model: self is not TECSModel: #{self.class}"
    end
    self
  end
end

#modifiedObject



75
76
77
78
# File 'lib/tecscde/tm_object.rb', line 75

def modified
  model.add_change_set(self)
  yield
end