undraw 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/undraw/helper.rb +4 -4
- data/lib/undraw/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b52688b98b807bf1c3849a9c570c5a04546f39d8aef8d0d3bd24f92d150a38ea
|
4
|
+
data.tar.gz: 9c5be8741beaac9e606a0d470073b3cb3603ed8e95a4e22ab96356e67b32e389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 116705151d9904f8d02c386b6140438251a928f9516f7b2ecc0fb188bb1ebbc00222a2cdfad7aa07e8a197133883807ece58a5230e5bc82307864c3c6adbc89d
|
7
|
+
data.tar.gz: 0db9810af88c5cf9d01d68b2b46a45d437b788727141229501a8d5f1fe6e19b3c36d18bdc95a55440f40f54a04002c2c48624ebe82ae0ccb9541e58fe7495bff
|
data/Gemfile.lock
CHANGED
data/lib/undraw/helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Undraw
|
2
2
|
module Helper
|
3
3
|
def undraw(filename, options = {})
|
4
|
-
svg_file =
|
4
|
+
svg_file = read_undraw_svg(filename)
|
5
5
|
color = options.delete(:color)
|
6
|
-
output =
|
6
|
+
output = recolor_undraw_svg(svg_file, color)
|
7
7
|
InlineSvg::TransformPipeline.generate_html_from(output, options).html_safe
|
8
8
|
rescue Errno::ENOENT => e
|
9
9
|
raise Undraw::FileNotFound,
|
@@ -12,13 +12,13 @@ module Undraw
|
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
def
|
15
|
+
def read_undraw_svg(filename)
|
16
16
|
asset_path = "#{Undraw.root}/vendor/assets/images/undraw/#{filename}.svg"
|
17
17
|
vendor_path = "#{Rails.root}/vendor/assets/images/undraw/#{filename}.svg"
|
18
18
|
File.read(File.exist?(vendor_path) ? vendor_path : asset_path)
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def recolor_undraw_svg(svg_file, color)
|
22
22
|
if color.is_a?(Hash)
|
23
23
|
# :todo:
|
24
24
|
# = undraw("building", color: { primary: #ff6347, hair: black }, class: 'undraw-features', size: "350*150")
|
data/lib/undraw/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: undraw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mkhairi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inline_svg
|