victor 0.3.1 → 0.3.2
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/README.md +7 -0
- data/lib/victor/svg_base.rb +4 -3
- data/lib/victor/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6540ebf1d8dba779d9da76d9755fb2fc65e6eb7f9119c0cc904fc3ad5d2f9cf
|
4
|
+
data.tar.gz: 332cb3428d65f3095f580229ed6ce5180de3b57fd41bc79d23c45f5ed72c7abd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cf0bc30d5201b6f2d2ec271b67d9e8ebf5ae18b4f3bba9324a655b22b3f20f19d259188a174ae40cf2ef41674a2f4c1cbc35953e2ad499cf1122702138bda3f
|
7
|
+
data.tar.gz: 81811e7d304675e2f5585b4debe09867c8a771b131f9f228fad15b7785d0754191b72f44306ce9acbcf5a686d9bb7c56a653d02ef2349821b695bb41ce887888
|
data/README.md
CHANGED
@@ -284,6 +284,13 @@ svg = Victor::SVG.new template: 'path/to/template.svg'
|
|
284
284
|
See the [templates] folder for an understanding of how templates are
|
285
285
|
structured.
|
286
286
|
|
287
|
+
Templates can also be provided when rendering or saving the output:
|
288
|
+
|
289
|
+
```ruby
|
290
|
+
svg.save 'filename', template: :minimal
|
291
|
+
svg.render template: :minimal
|
292
|
+
```
|
293
|
+
|
287
294
|
|
288
295
|
### CSS
|
289
296
|
|
data/lib/victor/svg_base.rb
CHANGED
@@ -63,7 +63,8 @@ module Victor
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def render
|
66
|
+
def render(template: nil)
|
67
|
+
@template = template if template
|
67
68
|
css_string = CSS.new css
|
68
69
|
|
69
70
|
svg_template % {
|
@@ -78,9 +79,9 @@ module Victor
|
|
78
79
|
content.join "\n"
|
79
80
|
end
|
80
81
|
|
81
|
-
def save(filename)
|
82
|
+
def save(filename, template: nil)
|
82
83
|
filename = "#{filename}.svg" unless filename =~ /\..{2,4}$/
|
83
|
-
File.write filename, render
|
84
|
+
File.write filename, render(template: template)
|
84
85
|
end
|
85
86
|
|
86
87
|
protected
|
data/lib/victor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: victor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build SVG images with ease
|
14
14
|
email: db@dannyben.com
|
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
|
-
rubygems_version: 3.
|
50
|
+
rubygems_version: 3.1.2
|
51
51
|
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: SVG Builder
|