Method: Attribute#initialize

Defined in:
lib/xmimodel/attribute.rb

#initialize(xml, parent_tag) ⇒ Attribute

Returns a new instance of Attribute.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/xmimodel/attribute.rb', line 20

def initialize(xml, parent_tag)
  super(xml, parent_tag)
  
  @clazz = parent_tag

  @name = xml.attribute("name").to_s.strip
  @visibility = xml.attribute("visibility").to_s
  @visibility = "private" if @visibility == ""

  @obj_type = XmiHelper.attribute_type(xml)
  @type = XmiHelper.attribute_type_name(xml)   

  @initial_value = XmiHelper.attribute_initial_value(xml)
  @multiplicity_range = XmiHelper.multiplicity_range(xml)

  @stereotypes = Array.new
  XmiHelper.stereotypes(xml).each do |uml_stereotype|
    stereotype = Stereotype.new(uml_stereotype, self)
    @stereotypes << stereotype
  end  

  @tagged_values = Array.new
  XmiHelper.tagged_values(xml).each do |uml_tagged_value|
    tagged_value = TaggedValue.new(uml_tagged_value, self)
    @tagged_values << tagged_value
  end    
end