Class: WikiAvro::XML::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/wikiavro/xml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attrObject (readonly)

Returns the value of attribute attr.



102
103
104
# File 'lib/wikiavro/xml.rb', line 102

def attr
  @attr
end

Instance Method Details

#nameObject

Raises:

  • (NotImplementedError)


104
105
106
# File 'lib/wikiavro/xml.rb', line 104

def name
  raise NotImplementedError.new('name')
end

#optional?Boolean

Returns:

  • (Boolean)


108
109
110
# File 'lib/wikiavro/xml.rb', line 108

def optional?
  false
end

#parse(output, parent, reader) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/wikiavro/xml.rb', line 112

def parse(output, parent, reader)
  if parent.nil? && reader.name != self.name
    raise RuntimeError.new('reader.name != self.name')
  else
    WikiAvro::XML::to_element(output, reader, self.name)
  end

  reset
  @attr = parse_attributes(output, parent, reader)
  parse_content(output, parent, reader)
  handle_content(output, parent, reader)
end