Class: Svgle::Image

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

Instance Method Summary collapse

Instance Method Details

#boundaryObject



72
73
74
75
# File 'lib/svgle.rb', line 72

def boundary()
  x1, y1, w, h = [x, y, width, height].map(&:to_i)
  [x1, y1, x1+w, y1+h]
end

#src=(s) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/svgle.rb', line 77

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