svgshield 0.1.3 → 0.1.4
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 +4 -4
- data/.rubocop.yml +14 -0
- data/lib/svgshield.rb +5 -5
- data/lib/svgshield/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6348c79c8d12e54c74a8686822bf23f39f02ced3
|
4
|
+
data.tar.gz: 3bebf1c6b8441ec6ea463585d0b829536b733074
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d50bc2ab35cf95ac233570fbaf134b1359a781fc61fa0801309cdf90ed547b2c01f83913f019e6f87187c53e638b1511ed85c99d0a0e2d4aeeb7407de2731c59
|
7
|
+
data.tar.gz: 79cdbb0e401cf6a030f24573e47315b48e2e1af9315767d3bb663f89db1daba142bdf980831e41e1b364e4e19c61d053ef522698103b27b78c403bd4fdf96b74
|
data/.rubocop.yml
ADDED
data/lib/svgshield.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rasem'
|
2
2
|
require 'color'
|
3
|
-
require
|
3
|
+
require 'svgshield/version'
|
4
4
|
|
5
5
|
class Svgshield
|
6
6
|
attr_reader :shield
|
@@ -8,8 +8,8 @@ class Svgshield
|
|
8
8
|
def initialize(subject, status, color = '#aaa')
|
9
9
|
color = Color::CSS[color] if color[0] == '#'
|
10
10
|
|
11
|
-
# subject_width = 37
|
12
|
-
# status_width = 53
|
11
|
+
# subject_width = 37
|
12
|
+
# status_width = 53
|
13
13
|
full_width = 86
|
14
14
|
full_height = 20
|
15
15
|
|
@@ -26,7 +26,7 @@ class Svgshield
|
|
26
26
|
group 'clip-path' => 'url(#a)' do
|
27
27
|
path fill: '#555', d: "M0 0h37v#{full_height}H0z"
|
28
28
|
path fill: color, d: "M37 0h49v#{full_height}H37z"
|
29
|
-
path fill: 'url(#b)' d: "M0 0h#{full_width}v#{full_height}H0z"
|
29
|
+
path fill: 'url(#b)', d: "M0 0h#{full_width}v#{full_height}H0z"
|
30
30
|
end
|
31
31
|
|
32
32
|
group(
|
@@ -52,7 +52,7 @@ class Svgshield
|
|
52
52
|
def string_width(string)
|
53
53
|
# Output is (theoretically, anyway) in pixels
|
54
54
|
|
55
|
-
string.chars.inject(0) { |
|
55
|
+
string.chars.inject(0) { |a, e| a + char_width(e) }.round 0
|
56
56
|
end
|
57
57
|
|
58
58
|
def char_width(char)
|
data/lib/svgshield/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svgshield
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evertrue, Inc
|
@@ -103,6 +103,7 @@ extra_rdoc_files: []
|
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
105
|
- ".rspec"
|
106
|
+
- ".rubocop.yml"
|
106
107
|
- ".travis.yml"
|
107
108
|
- Gemfile
|
108
109
|
- LICENSE.txt
|