victor 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: b3cdae62bfe9bdf04869f383eef7038fe861d35a
4
- data.tar.gz: ed07aa80408c354b15375e1ba63895278b1de630
3
+ metadata.gz: 431ab32a3fa62036ae96a19407b9d094c341d528
4
+ data.tar.gz: e89f0cd32f623efb913637ee3008138316c8cc07
5
5
  SHA512:
6
- metadata.gz: 66282482e34d83d87407df196c2fafd5cd8d117e3fa3f719f6454edb3ad6edf098790cfed7cbc8fa6a06be6d06e6ed1ff826a2d8d5ffc1ddede6a9470601775f
7
- data.tar.gz: 29eb27242933106499bf0a585ba1e7da56a8f6bb8b7e049160b6be3df83bdb176681d62b33c37f8d5f7dbadd0735e214f1e2bac1340d19d7b194ae9cb65f8ebf
6
+ metadata.gz: 8af34c733b974281ea9391200043342c29f49435ab87b99500b53c0aee13636f2995bfd519dac077f9b00a77dfa5ccf1adc2a77de204b8369c73315cd4298b39
7
+ data.tar.gz: 8bf0c2746c191ed22d70017bd37518edbd8a745de74707844d2bec215fd8b9cb5ad2d9634cd9636d1a495eba2428f8229aa5716c1a8f1f58abb3ba5d4c8fed01
data/README.md CHANGED
@@ -213,6 +213,24 @@ svg.build do
213
213
  end
214
214
  ```
215
215
 
216
+ You can also set CSS by providing a hash:
217
+
218
+ ```ruby
219
+ svg.css = {
220
+ '.bar': {
221
+ fill: '#666',
222
+ stroke: '#fff',
223
+ stroke_width: 1
224
+ },
225
+ '.negative': {
226
+ fill: '#f66'
227
+ },
228
+ '.positive': {
229
+ fill: '#6f6'
230
+ }
231
+ }
232
+ ```
233
+
216
234
  Underscore characters will be converted to dashes (`stroke_width` becomes
217
235
  `stroke-width`).
218
236
 
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  module Victor
4
2
 
5
3
  class SVG
@@ -44,10 +42,14 @@ module Victor
44
42
  svg_template % {
45
43
  css: CSS.new(css),
46
44
  attributes: svg_attributes,
47
- content: content.join("\n")
45
+ content: content.join("\n")
48
46
  }
49
47
  end
50
48
 
49
+ def to_s
50
+ content.join "\n"
51
+ end
52
+
51
53
  def save(filename)
52
54
  filename = "#{filename}.svg" unless filename =~ /\..{2,4}$/
53
55
  File.write filename, render
@@ -1,7 +1,9 @@
1
1
  <?xml version="1.0" standalone="no"?>
2
2
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
3
 
4
- <svg %{attributes} xmlns="http://www.w3.org/2000/svg">
4
+ <svg %{attributes}
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ xmlns:xlink="http://www.w3.org/1999/xlink">
5
7
 
6
8
  <style type="text/css">
7
9
  <![CDATA[
@@ -1,3 +1,3 @@
1
1
  module Victor
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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.1.2
4
+ version: 0.1.3
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: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runfile
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.5.1
117
+ rubygems_version: 2.6.6
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: SVG Builder