class RubyDocx::Elements::Link
Attributes
content[R]
href[R]
html_content[R]
Public Instance Methods
content=(txt)
click to toggle source
# File lib/ruby_docx/elements/link.rb, line 21 def content=(txt) @content = txt end
element()
click to toggle source
# File lib/ruby_docx/elements/link.rb, line 5 def element @element ||= @node.children.first end
href=(an)
click to toggle source
# File lib/ruby_docx/elements/link.rb, line 13 def href=(an) @href = an end
html_content=(html)
click to toggle source
# File lib/ruby_docx/elements/link.rb, line 29 def html_content=(html) @html_content = html end
replace(url)
click to toggle source
# File lib/ruby_docx/elements/link.rb, line 33 def replace(url) self.href = url end
to_html()
click to toggle source
# File lib/ruby_docx/elements/link.rb, line 37 def to_html if !self.href "#{self.html_content}" elsif self.href.to_s =~ /^http/ "<a href=\"#{self.href}\">#{self.html_content}</a>" else "<a href=\"##{self.href}\">#{self.html_content}</a>" end end
to_s()
click to toggle source
# File lib/ruby_docx/elements/link.rb, line 47 def to_s self.content.to_s end