Class: Odf::Element::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/odf/element/abstract.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, options = {}) ⇒ Abstract

Returns a new instance of Abstract.



6
7
8
9
10
# File 'lib/odf/element/abstract.rb', line 6

def initialize(parent, options = {})
  @parent = parent
  @root   = document.content.xml.create_element(xml_tag, fetch_options(options))
  @parent.root.add_child(@root)
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



4
5
6
# File 'lib/odf/element/abstract.rb', line 4

def parent
  @parent
end

#rootObject (readonly)

Returns the value of attribute root.



4
5
6
# File 'lib/odf/element/abstract.rb', line 4

def root
  @root
end

Instance Method Details

#documentObject



21
22
23
# File 'lib/odf/element/abstract.rb', line 21

def document
  parent.document
end

#valid_optionsObject

Accessor for valid options of element



13
14
15
# File 'lib/odf/element/abstract.rb', line 13

def valid_options
  @valid_options ||= defined?(self.class::VALID_OPTIONS) ? self.class::VALID_OPTIONS : {}
end

#xml_tagObject



17
18
19
# File 'lib/odf/element/abstract.rb', line 17

def xml_tag
  self.class::XML_TAG
end