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

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

Instance Method Summary collapse

Instance Method Details

#create_with(element) ⇒ Object



83
84
85
86
# File 'lib/docx/elements/element.rb', line 83

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



88
89
90
91
92
# File 'lib/docx/elements/element.rb', line 88

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