Class: Konjak::TranslationUnitVariant

Inherits:
StructuralElement show all
Defined in:
lib/konjak/translation_unit_variant.rb

Constant Summary collapse

TAG_NAME =
'tuv'

Instance Method Summary collapse

Methods inherited from Element

#__getobj__, #initialize

Constructor Details

This class inherits a constructor from Konjak::Element

Instance Method Details

#can_contain?(element) ⇒ Boolean

FIXME

Zero, one or more <note>, or <prop> elements in any order, followed by
One <seg> element.

Returns:

  • (Boolean)


40
41
42
# File 'lib/konjak/translation_unit_variant.rb', line 40

def can_contain?(element)
  [Note, Property, Segment].any? {|c| c === element }
end

#notesObject

childrens



22
23
24
# File 'lib/konjak/translation_unit_variant.rb', line 22

def notes
  children.select {|c| c.name == 'note' }.map! {|n| Note.new(n) }
end

#propertiesObject



26
27
28
# File 'lib/konjak/translation_unit_variant.rb', line 26

def properties
  children.select {|c| c.name == 'prop' }.map! {|n| Property.new(n) }
end

#segmentObject



30
31
32
# File 'lib/konjak/translation_unit_variant.rb', line 30

def segment
  Segment.new(children.detect {|c| c.name == Segment::TAG_NAME })
end