Class: Svgle::Image

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

Instance Method Summary collapse

Instance Method Details

#boundaryObject



80
81
82
83
# File 'lib/svgle.rb', line 80

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

#src=(s) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/svgle.rb', line 85

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