Class: Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/xmimodel/tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml, parent_tag) ⇒ Tag

Constructor.

Parameters:

  • xml (Nokogiri::XML::Element)
  • parent_tag (Tag)

19
20
21
22
23
24
25
26
27
# File 'lib/xmimodel/tag.rb', line 19

def initialize(xml, parent_tag)

	raise "Diferente de Tag. #{parent_tag.class}" if !parent_tag.kind_of?(Tag) && parent_tag.class != XmiModel

	@xml = xml
	@parent_tag = parent_tag

	@id = xml.attribute("xmi.id").to_s
end

Instance Attribute Details

#idString (readonly)

Returns:

  • (String)

12
13
14
# File 'lib/xmimodel/tag.rb', line 12

def id
  @id
end

#parent_tagTag (readonly)

Returns:


9
10
11
# File 'lib/xmimodel/tag.rb', line 9

def parent_tag
  @parent_tag
end

#xmlNokogiri::XML::Element (readonly)

Returns:

  • (Nokogiri::XML::Element)

6
7
8
# File 'lib/xmimodel/tag.rb', line 6

def xml
  @xml
end

Instance Method Details

#xml_rootObject


29
30
31
32
33
34
35
# File 'lib/xmimodel/tag.rb', line 29

def xml_root
	parent_tag = @parent_tag
	until parent_tag.class == XmiModel
		parent_tag = parent_tag.parent_tag
	end
	parent_tag
end