Class: SVG::Anchor

Inherits:
ElementBase show all
Includes:
ArrayMixin
Defined in:
lib/ruby-svg/element.rb

Overview

#

Anchor Class

Instance Attribute Summary collapse

Attributes inherited from ElementBase

#attr, #class, #id, #style, #transform

Instance Method Summary collapse

Methods included from ArrayMixin

#<<, #[], #[]=, #clear, #each, #first, #last

Constructor Details

#initialize(uri) ⇒ Anchor

Returns a new instance of Anchor.



75
76
77
78
79
# File 'lib/ruby-svg/element.rb', line 75

def initialize(uri)
  super()
  @uri      = uri
  @elements = []
end

Instance Attribute Details

#elementsObject (readonly)

Returns the value of attribute elements.



82
83
84
# File 'lib/ruby-svg/element.rb', line 82

def elements
  @elements
end

#uriObject

Returns the value of attribute uri.



81
82
83
# File 'lib/ruby-svg/element.rb', line 81

def uri
  @uri
end

Instance Method Details

#to_sObject



89
90
91
92
93
94
95
# File 'lib/ruby-svg/element.rb', line 89

def to_s
 text = %|<a|
 text << super()
 text << %| xlink:href="#{@uri}">\n|
 text << @elements.collect { |element| element.to_s + "\n" }.join
 text << %|</a>\n|
end