Module: Undraw::Helper

Defined in:
lib/undraw/helper.rb

Instance Method Summary collapse

Instance Method Details

#undraw(filename, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/undraw/helper.rb', line 3

def undraw(filename, options = {})
  svg_file = read_undraw_svg(filename)
  color = options.delete(:color)
  output = recolor_undraw_svg(svg_file, color)
  InlineSvg::TransformPipeline.generate_html_from(output, options).html_safe
rescue Errno::ENOENT => e
  raise Undraw::FileNotFound,
        "Asset not found: #{filename}, you can manually download and place svg file in this path #{e.message.split('-').last}"
end