Class: RubyDocx::Elements::Bookmark

Inherits:
Element
  • Object
show all
Defined in:
lib/ruby_docx/elements/bookmark.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#doc, #grid, #node, #style

Instance Method Summary collapse

Methods inherited from Element

#elements, #initialize, #inspect, #to_xml

Constructor Details

This class inherits a constructor from RubyDocx::Elements::Element

Instance Attribute Details

#anchorObject

Returns the value of attribute anchor.



3
4
5
# File 'lib/ruby_docx/elements/bookmark.rb', line 3

def anchor
  @anchor
end

Instance Method Details

#elementObject



5
6
7
# File 'lib/ruby_docx/elements/bookmark.rb', line 5

def element
  @element ||= @node.children.first
end

#replace(an) ⇒ Object



26
27
28
# File 'lib/ruby_docx/elements/bookmark.rb', line 26

def replace(an)
  self.anchor = an
end

#to_htmlObject



30
31
32
33
34
35
36
# File 'lib/ruby_docx/elements/bookmark.rb', line 30

def to_html
  if self.anchor
    "<span name=\"#{self.anchor}\"></span>"
  else
    ""
  end
end

#to_sObject



38
39
40
# File 'lib/ruby_docx/elements/bookmark.rb', line 38

def to_s
  ""
end