Class: SVG::Text
- Inherits:
-
ElementBase
- Object
- ElementBase
- SVG::Text
- Defined in:
- lib/ruby-svg/element.rb
Overview
#
Text Class
Instance Attribute Summary collapse
-
#length ⇒ Object
Returns the value of attribute length.
-
#length_adjust ⇒ Object
Returns the value of attribute length_adjust.
-
#text ⇒ Object
Returns the value of attribute text.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Attributes inherited from ElementBase
#attr, #class, #id, #style, #transform
Instance Method Summary collapse
-
#initialize(x, y, text) ⇒ Text
constructor
A new instance of Text.
- #to_s ⇒ Object
Constructor Details
#initialize(x, y, text) ⇒ Text
Returns a new instance of Text.
313 314 315 316 317 318 319 320 |
# File 'lib/ruby-svg/element.rb', line 313 def initialize(x, y, text) super() @x = x @y = y @text = text @length = nil @length_adjust = nil end |
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length.
322 323 324 |
# File 'lib/ruby-svg/element.rb', line 322 def length @length end |
#length_adjust ⇒ Object
Returns the value of attribute length_adjust.
322 323 324 |
# File 'lib/ruby-svg/element.rb', line 322 def length_adjust @length_adjust end |
#text ⇒ Object
Returns the value of attribute text.
322 323 324 |
# File 'lib/ruby-svg/element.rb', line 322 def text @text end |
#x ⇒ Object
Returns the value of attribute x.
322 323 324 |
# File 'lib/ruby-svg/element.rb', line 322 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
322 323 324 |
# File 'lib/ruby-svg/element.rb', line 322 def y @y end |
Instance Method Details
#to_s ⇒ Object
324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/ruby-svg/element.rb', line 324 def to_s svg = %|<text| svg << %| x="#{@x}"| if @x svg << %| y="#{@y}"| if @y svg << %| textLength="#{@length}"| if @length svg << %| lengthAdjust="#{@length_adjust}"| if @length_adjust svg << super() svg << %|>| svg << text svg << %|</text>| return svg end |