Class: SVG::Path

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

Overview

#

Path Class

Instance Attribute Summary collapse

Attributes inherited from ElementBase

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

Instance Method Summary collapse

Constructor Details

#initialize(path, length = nil) ⇒ Path

Returns a new instance of Path.



291
292
293
294
295
# File 'lib/ruby-svg/element.rb', line 291

def initialize(path, length = nil)
  super()
  @path   = path
  @length = length
end

Instance Attribute Details

#lengthObject

Returns the value of attribute length.



297
298
299
# File 'lib/ruby-svg/element.rb', line 297

def length
  @length
end

#pathObject

Returns the value of attribute path.



297
298
299
# File 'lib/ruby-svg/element.rb', line 297

def path
  @path
end

Instance Method Details

#to_sObject



299
300
301
302
303
304
305
# File 'lib/ruby-svg/element.rb', line 299

def to_s
  text = %|<path d="#{@path.join(' ')}"|
  text = %| length="#{@length}"| if @length
  text << super()
  text << %| />|
  return text
end