Class: SVG::Rect

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

Overview

#

Rect Class

Instance Attribute Summary collapse

Attributes inherited from ElementBase

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

Instance Method Summary collapse

Constructor Details

#initialize(x, y, width, height, rx = nil, ry = nil) ⇒ Rect

Returns a new instance of Rect.



122
123
124
125
126
127
128
129
130
131
# File 'lib/ruby-svg/element.rb', line 122

def initialize(x, y, width, height, rx = nil, ry = nil)
  super()

  @x      = x
  @y      = y
  @width  = width
  @height = height
  @rx     = rx
  @ry     = ry
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



133
134
135
# File 'lib/ruby-svg/element.rb', line 133

def height
  @height
end

#rxObject

Returns the value of attribute rx.



133
134
135
# File 'lib/ruby-svg/element.rb', line 133

def rx
  @rx
end

#ryObject

Returns the value of attribute ry.



133
134
135
# File 'lib/ruby-svg/element.rb', line 133

def ry
  @ry
end

#widthObject

Returns the value of attribute width.



133
134
135
# File 'lib/ruby-svg/element.rb', line 133

def width
  @width
end

#xObject

Returns the value of attribute x.



133
134
135
# File 'lib/ruby-svg/element.rb', line 133

def x
  @x
end

#yObject

Returns the value of attribute y.



133
134
135
# File 'lib/ruby-svg/element.rb', line 133

def y
  @y
end

Instance Method Details

#to_sObject



135
136
137
138
139
140
141
142
143
144
# File 'lib/ruby-svg/element.rb', line 135

def to_s
  text = %|<rect width="#{@width}" height="#{@height}"|
  text << %| x="#{@x}"|   if @x
  text << %| y="#{@y}"|   if @y
  text << %| rx="#{@rx}"| if @rx
  text << %| ry="#{@ry}"| if @ry
  text << super()
  text << %| />|
  return text
end