Class: Svgle::Image

Inherits:
SvgElement show all
Defined in:
lib/svgle.rb

Instance Attribute Summary

Attributes inherited from SvgElement

#attr_map

Instance Method Summary collapse

Instance Method Details

#boundaryObject



87
88
89
90
# 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) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 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