victor 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -0
- data/lib/victor/css.rb +16 -8
- data/lib/victor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98c7ece8b164674e9f575a651f7184a48deb28d5
|
4
|
+
data.tar.gz: 4752c3cbec9917b65a44303fa2e4c6f192242d3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8325e8a532a0999f63a81b0537822bd93465eb26a9dc36b8ee973238097380015478e6fffb6a989101adcbca73a481faa206dd13f817a3bc00bdb5518514014c
|
7
|
+
data.tar.gz: 448f222425c01a7efba6cda9d8b5ab11c81af9339df45e7eb12472938e505e7ac9b3d1cde66142351587e31b6e98853f48d3146b6658a98f2f9b297d608e956f
|
data/README.md
CHANGED
@@ -29,6 +29,32 @@ gem 'victor'
|
|
29
29
|
Examples
|
30
30
|
--------------------------------------------------
|
31
31
|
|
32
|
+
```ruby
|
33
|
+
require 'victor'
|
34
|
+
|
35
|
+
svg = SVG.new width: 140, height: 100, style: { background: '#ddd' }
|
36
|
+
|
37
|
+
svg.build do
|
38
|
+
rect x: 10, y: 10, width: 120, height: 80, rx: 10, fill: '#666'
|
39
|
+
|
40
|
+
circle cx: 50, cy: 50, r: 30, fill: 'yellow'
|
41
|
+
circle cx: 58, cy: 32, r: 4, fill: 'black'
|
42
|
+
polygon points: %w[45,50 80,30 80,70], fill: '#666'
|
43
|
+
|
44
|
+
3.times do |i|
|
45
|
+
x = 80 + i*18
|
46
|
+
circle cx: x, cy: 50, r: 4, fill: 'yellow'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
svg.save 'pacman'
|
51
|
+
```
|
52
|
+
|
53
|
+
Output:
|
54
|
+
|
55
|
+
[![pacman](https://cdn.rawgit.com/DannyBen/victor/master/examples/09_pacman.svg)](https://github.com/DannyBen/victor/blob/master/examples/09_pacman.rb)
|
56
|
+
|
57
|
+
|
32
58
|
See the [examples] folder for several ruby scripts and their SVG output.
|
33
59
|
|
34
60
|
|
data/lib/victor/css.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
1
|
module Victor
|
4
2
|
|
5
3
|
class CSS
|
@@ -10,14 +8,24 @@ module Victor
|
|
10
8
|
end
|
11
9
|
|
12
10
|
def to_s
|
11
|
+
convert_hash attributes
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def convert_hash(hash, indent=2)
|
17
|
+
return hash unless hash.is_a? Hash
|
18
|
+
|
13
19
|
result = []
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
result.push
|
20
|
+
hash.each do |key, value|
|
21
|
+
key = key.to_s.tr '_', '-'
|
22
|
+
if value.is_a? Hash
|
23
|
+
result.push " " * indent + "#{key} {"
|
24
|
+
result.push convert_hash(value, indent+2)
|
25
|
+
result.push " " * indent + "}"
|
26
|
+
else
|
27
|
+
result.push " " * indent + "#{key}: #{value};"
|
19
28
|
end
|
20
|
-
result.push " }"
|
21
29
|
end
|
22
30
|
|
23
31
|
result.join "\n"
|
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.1.
|
4
|
+
version: 0.1.1
|
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-
|
11
|
+
date: 2016-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: runfile
|