Class: RODF::Hyperlink

Inherits:
ParagraphContainer show all
Defined in:
lib/rodf/hyperlink.rb

Instance Method Summary collapse

Methods inherited from ParagraphContainer

#<<, #content_parts, #content_parts_xml, #link, #method_missing, #span, #tab

Methods inherited from Container

create

Constructor Details

#initialize(first, second = {}) ⇒ Hyperlink



3
4
5
6
7
8
9
10
11
12
# File 'lib/rodf/hyperlink.rb', line 3

def initialize(first, second = {})
  super

  if second.instance_of?(Hash) && second.empty?
    @href = first
  else
    span(first)
    @href = second.instance_of?(Hash) ? second[:href] : second
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RODF::ParagraphContainer

Instance Method Details

#xmlObject



14
15
16
17
18
# File 'lib/rodf/hyperlink.rb', line 14

def xml
  Builder::XmlMarkup.new.text:a, 'xlink:href' => @href do |a|
    a << content_parts_xml
  end
end