victor 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c7ece8b164674e9f575a651f7184a48deb28d5
4
- data.tar.gz: 4752c3cbec9917b65a44303fa2e4c6f192242d3c
3
+ metadata.gz: b3cdae62bfe9bdf04869f383eef7038fe861d35a
4
+ data.tar.gz: ed07aa80408c354b15375e1ba63895278b1de630
5
5
  SHA512:
6
- metadata.gz: 8325e8a532a0999f63a81b0537822bd93465eb26a9dc36b8ee973238097380015478e6fffb6a989101adcbca73a481faa206dd13f817a3bc00bdb5518514014c
7
- data.tar.gz: 448f222425c01a7efba6cda9d8b5ab11c81af9339df45e7eb12472938e505e7ac9b3d1cde66142351587e31b6e98853f48d3146b6658a98f2f9b297d608e956f
6
+ metadata.gz: 66282482e34d83d87407df196c2fafd5cd8d117e3fa3f719f6454edb3ad6edf098790cfed7cbc8fa6a06be6d06e6ed1ff826a2d8d5ffc1ddede6a9470601775f
7
+ data.tar.gz: 29eb27242933106499bf0a585ba1e7da56a8f6bb8b7e049160b6be3df83bdb176681d62b33c37f8d5f7dbadd0735e214f1e2bac1340d19d7b194ae9cb65f8ebf
data/README.md CHANGED
@@ -93,6 +93,13 @@ svg.rect x: 2, y: 2, width: 200, height: 200
93
93
  # => <rect x="2" y="2" width="200" height="200"/>
94
94
  ```
95
95
 
96
+ In other words, these are the same:
97
+
98
+ ```ruby
99
+ svg.element :anything, option: 'value'
100
+ svg.anything option: 'value'
101
+ ```
102
+
96
103
  You can use the `build` method, to generate the SVG with a block
97
104
 
98
105
  ```ruby
@@ -114,11 +121,10 @@ If the value of an attribute is an array, it will be converted to a
114
121
  space delimited string:
115
122
 
116
123
  ```ruby
117
- svg.path ['M', 150, 0, 'L', 75, 200, 'L', 225, 200, 'Z']
118
- # => <rect x=0 y=0 width=100 height=100 style="stroke:#ccc; fill:red"/>
124
+ svg.path d: ['M', 150, 0, 'L', 75, 200, 'L', 225, 200, 'Z']
125
+ # => <path d="M 159 9 L 75 200 L 225 200 Z"/>
119
126
  ```
120
127
 
121
-
122
128
  For SVG elements that have an inner content - such as text - simply pass it as
123
129
  the first argument:
124
130
 
@@ -127,6 +133,19 @@ svg.text "Victor", x: 40, y: 50
127
133
  # => <text x="40" y="50">Victor</text>
128
134
  ```
129
135
 
136
+ You can also nest elements with blocks:
137
+
138
+ ```ruby
139
+ svg.build do
140
+ g font_size: 30, font_family: 'arial', fill: 'white' do
141
+ text "Scalable Victor Graphics", x: 40, y: 50
142
+ end
143
+ end
144
+ # => <g font-size="30" font-family="arial" fill="white">
145
+ # <text x="40" y="50">Scalable Victor Graphics</text>
146
+ # </g>
147
+ ```
148
+
130
149
  Underscores in attribute names are converted to dashes:
131
150
 
132
151
  ```ruby
@@ -28,6 +28,7 @@ module Victor
28
28
 
29
29
  def to_style
30
30
  mapped = attributes.map do |key, value|
31
+ key = key.to_s.tr '_', '-'
31
32
  "#{key}:#{value}"
32
33
  end
33
34
 
@@ -1,3 +1,3 @@
1
1
  module Victor
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.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.1.1
4
+ version: 0.1.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: 2016-05-29 00:00:00.000000000 Z
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runfile