class Svg
Public Class Methods
new()
click to toggle source
# File lib/penticon/svgrb.rb, line 3 def initialize @svg_string = "" @height = nil @width = nil end
Public Instance Methods
get_string()
click to toggle source
# File lib/penticon/svgrb.rb, line 25 def get_string() return header() + @svg_string + footer() end
header()
click to toggle source
# File lib/penticon/svgrb.rb, line 17 def header() return "<svg xmlns='http://www.w3.org/2000/svg' width='#{@width}' height='#{@height}'>" end
rect(x, y, w, h, args)
click to toggle source
# File lib/penticon/svgrb.rb, line 29 def rect(x, y, w, h, args) write_arg = write_args(args) rect_str = "<rect x='#{x}' y='#{y}' width='#{w}' height='#{h}' #{write_arg} />" @svg_string += rect_str end
set_height(h)
click to toggle source
# File lib/penticon/svgrb.rb, line 13 def set_height(h) @height = Integer(h) end
set_width(w)
click to toggle source
# File lib/penticon/svgrb.rb, line 9 def set_width(w) @width = Integer(w) end
write_args(args)
click to toggle source
# File lib/penticon/svgrb.rb, line 35 def write_args(args) #args = {:fill=>\"this\"} args = args.to_s args.gsub! '{', '' args.gsub! '}', '' args.gsub! '>', '' args.gsub! ':', '' return args end