class Svgle::Image

Public Instance Methods

boundary() click to toggle source
# File lib/svgle.rb, line 87
def boundary()
  x1, y1, w, h = [x, y, width, height].map(&:to_i)
  [x1, y1, x1+w, y1+h]
end
src=(s) click to toggle source
# File lib/svgle.rb, line 92
def src=(s)
  
  @src = s
  
  self.attributes[:'xlink:href'] = if s =~ /^http/ then
            
    filepath = Tempfile.new('svgle').path + File.basename(s)
    File.write filepath, RXFHelper.read(s).first
    
    filepath
    
  else
    s
  end
  
end