Class: RSVGR::Rect

Inherits:
Object
  • Object
show all
Defined in:
lib/rsvgr.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Rect

Returns a new instance of Rect.



90
91
92
93
94
95
96
# File 'lib/rsvgr.rb', line 90

def initialize *args
  @x = 0
  @y = 0
  @width = 1
  @height = 1
  super
end

Instance Method Details

#to_sObject



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/rsvgr.rb', line 97

def to_s
  "<rect"                                                     +
  " x=\"#{DEFAULT_SIZE * @x}\""                               +
  " y=\"#{DEFAULT_SIZE * @y}\""                               +
  " width=\"#{DEFAULT_SIZE * @width}\""                       +
  " height=\"#{DEFAULT_SIZE * @height}\""                     +
  "#{" stroke=\"#{@stroke_color}\"" if @stroke_color}"        +
  "#{" stroke-width=\"#{@stroke_width}\"" if @stroke_width}"  +
  "#{" fill=\"#{@fill_color}\"" if @fill_color}"              +
  "/>\n"
end