svgshield 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 +4 -4
- data/README.md +2 -2
- data/lib/svgshield/version.rb +1 -1
- data/lib/svgshield.rb +8 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f15084c4017e592e7475989d0eac4cf6c7411f7
|
4
|
+
data.tar.gz: 60bb1f8dc3184cf1eb669b6a811ed00b3768c547
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a4786f17d7100380fdbf9946c8e4a773a419ae2613eac8890dae35708595cc22c8b09cbe28e59f8e7e23dd5292d9022b50901b08bfeded74c141d4bcf7ff96
|
7
|
+
data.tar.gz: 43b864f38614f6366cd8f38a744a307f3256344bb22441a761bc16196ba22760f8d2588ffc38284cfc549825116a7f3cfa565eb56ff52374c30cd846fc2bbba1
|
data/README.md
CHANGED
@@ -21,8 +21,8 @@ And then execute:
|
|
21
21
|
To generate an image object:
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
redimage1 = Svgshield.new('Subject', 'Status', 'red') # color words
|
25
|
-
redimage2 = Svgshield.new('Subject', 'Status', '#f00') # hexadecimal colors
|
24
|
+
redimage1 = Svgshield.new('Subject', 'Status', 'red').to_s # color words
|
25
|
+
redimage2 = Svgshield.new('Subject', 'Status', '#f00').to_s # hexadecimal colors
|
26
26
|
```
|
27
27
|
|
28
28
|
## Development
|
data/lib/svgshield/version.rb
CHANGED
data/lib/svgshield.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'rasem'
|
2
|
+
require 'color'
|
2
3
|
require "svgshield/version"
|
3
4
|
|
4
5
|
class Svgshield
|
6
|
+
attr_reader :shield
|
7
|
+
|
5
8
|
def initialize(subject, status, color = '#aaa')
|
6
9
|
color = Color::CSS[color] if color[0] == '#'
|
7
10
|
|
8
|
-
Rasem::SVGImage.new(width: 90, height: 20) do
|
11
|
+
@shield = Rasem::SVGImage.new(width: 90, height: 20) do
|
9
12
|
linearGradient('a', x2: 0, y2: '100%') do
|
10
13
|
stop 0, '#bbb', '.1'
|
11
14
|
stop 1, nil, '.1'
|
@@ -29,4 +32,8 @@ class Svgshield
|
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
35
|
+
|
36
|
+
def to_s
|
37
|
+
shield.to_s
|
38
|
+
end
|
32
39
|
end
|