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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff2d91fe91857b10d35b9762dcbec3ee26ac3028c5522b7bdb33f73570a53422
4
- data.tar.gz: b1fce99903fcf5cc4d1b024b48d8382046e4426c57bb7a621265abb3db187008
3
+ metadata.gz: e6540ebf1d8dba779d9da76d9755fb2fc65e6eb7f9119c0cc904fc3ad5d2f9cf
4
+ data.tar.gz: 332cb3428d65f3095f580229ed6ce5180de3b57fd41bc79d23c45f5ed72c7abd
5
5
  SHA512:
6
- metadata.gz: 25eac4f567fa4b492bc9bded59d2194f2ac4c89283f71b748db2c8ccc3245793cdea7535131058282dace0fd366aa15f4e676414c2a2c823ea37d9f7777b01e4
7
- data.tar.gz: 694d7f6ff8b2264aec64d3d2955751b9b375a0e25cc4b1aa35c6328de97ee6ce6996ff8744bc86bb5b50cb9ed712644c25431f2a7213b68a8ba05e5b1fdb9802
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Victor
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
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.1
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-05 00:00:00.000000000 Z
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.0.3
50
+ rubygems_version: 3.1.2
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: SVG Builder