Class: SVG::Line

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

Overview

#

Line Class

Instance Attribute Summary collapse

Attributes inherited from ElementBase

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

Instance Method Summary collapse

Constructor Details

#initialize(x1, y1, x2, y2) ⇒ Line

Returns a new instance of Line.



199
200
201
202
203
204
205
# File 'lib/ruby-svg/element.rb', line 199

def initialize(x1, y1, x2, y2)
  super()
  @x1 = x1
  @y1 = y1
  @x2 = x2
  @y2 = y2
end

Instance Attribute Details

#x1Object

Returns the value of attribute x1.



207
208
209
# File 'lib/ruby-svg/element.rb', line 207

def x1
  @x1
end

#x2Object

Returns the value of attribute x2.



207
208
209
# File 'lib/ruby-svg/element.rb', line 207

def x2
  @x2
end

#y1Object

Returns the value of attribute y1.



207
208
209
# File 'lib/ruby-svg/element.rb', line 207

def y1
  @y1
end

#y2Object

Returns the value of attribute y2.



207
208
209
# File 'lib/ruby-svg/element.rb', line 207

def y2
  @y2
end

Instance Method Details

#to_sObject



209
210
211
212
213
214
# File 'lib/ruby-svg/element.rb', line 209

def to_s
  text = %|<line x1="#{@x1}" y1="#{@y1}" x2="#{@x2}" y2="#{@y2}"|
  text << super()
  text << %| />|
  return text
end