Module: Docx::Elements::Element::ClassMethods

Defined in:
lib/docx/elements/element.rb

Instance Method Summary collapse

Instance Method Details

#create_with(element) ⇒ Object



92
93
94
95
# File 'lib/docx/elements/element.rb', line 92

def create_with(element)
  # Need to somehow get the xml document accessible here by default, but this is alright in the interim
  self.new(Nokogiri::XML::Node.new("w:#{self.tag}", element.node))
end

#create_within(element) ⇒ Object



97
98
99
100
101
# File 'lib/docx/elements/element.rb', line 97

def create_within(element)
  new_element = create_with(element)
  new_element.append_to(element)
  new_element
end