usps_flags-grades 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/.rubocop.yml +95 -0
- data/.travis.yml +3 -0
- data/Gemfile.lock +20 -1
- data/lib/usps_flags/grades.rb +102 -100
- data/lib/usps_flags/grades/config.rb +5 -3
- data/lib/usps_flags/grades/edpro.rb +14 -12
- data/lib/usps_flags/grades/grade.rb +81 -77
- data/lib/usps_flags/grades/membership.rb +128 -124
- data/lib/usps_flags/grades/merit_marks.rb +50 -54
- data/spec/usps_flags/grades_spec.rb +44 -43
- data/usps_flags-grades.gemspec +7 -5
- metadata +44 -3
@@ -4,137 +4,141 @@
|
|
4
4
|
#
|
5
5
|
# This class should never need to be called directly.
|
6
6
|
# @private
|
7
|
-
class USPSFlags
|
8
|
-
class
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
class USPSFlags
|
8
|
+
class Grades
|
9
|
+
class Membership
|
10
|
+
class << self
|
11
|
+
def get(type)
|
12
|
+
<<~SVG
|
13
|
+
#{arrow { send("#{type}_bar") }}
|
14
|
+
#{send(type)}
|
15
|
+
SVG
|
16
|
+
end
|
15
17
|
|
16
|
-
|
18
|
+
private
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
def arrow
|
21
|
+
<<~SVG
|
22
|
+
<polyline points="0,250 75,220 75,240 150,240 150,260 75,260 75,280 0,250" fill="#{USPSFlags::Config::GOLD}" />
|
23
|
+
#{yield}
|
24
|
+
<polyline points="600,240 675,240 675,220 750,250 675,280 675,260 600,260 600,240" fill="#{USPSFlags::Config::GOLD}" />
|
25
|
+
SVG
|
26
|
+
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def senior_bar
|
29
|
+
<<~SVG
|
30
|
+
<polyline points="145,240 350,240 350,260 145,260 145,240" fill="#{USPSFlags::Config::GOLD}" />
|
31
|
+
<polyline points="400,240 610,240 610,260 400,260 400,240" fill="#{USPSFlags::Config::GOLD}" />
|
32
|
+
SVG
|
33
|
+
end
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
def life_bar
|
36
|
+
<<~SVG
|
37
|
+
<polyline points="145,240 275,240 275,260 145,260 145,240" fill="#{USPSFlags::Config::GOLD}" />
|
38
|
+
<polyline points="400,240 610,240 610,260 475,260 475,240" fill="#{USPSFlags::Config::GOLD}" />
|
39
|
+
SVG
|
40
|
+
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
def senior
|
43
|
+
<<~SVG
|
44
|
+
<polyline points="325,200 350,200 375,275 400,200 425,200 390,300 360,300 325,200" fill="#{USPSFlags::Config::GOLD}" />
|
45
|
+
SVG
|
46
|
+
end
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
def life
|
49
|
+
<<~SVG
|
50
|
+
#{senior}
|
51
|
+
<g transform="translate(285, 170) scale(0.2)">
|
52
|
+
#{laurel}
|
53
|
+
</g>
|
54
|
+
SVG
|
55
|
+
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
57
|
+
def laurel
|
58
|
+
<<~SVG
|
59
|
+
<g transform="matrix(1.1420287,0,0,1.1420287,-54.210052,-119.65049)">
|
60
|
+
<path
|
61
|
+
d="m 107.6,178.2 c -0.2,0.7 -1.2,4.7 -2.1,8.8 -0.9,4.1 -2.2,9.7 -3,12.5 -7.9,29.7 -8.9,51.9 -2.9,67.7 4.5,12.2 7,16.7 8.9,16.7 2.4,0.1 12.2,-15.8 16.2,-26.4 6.4,-16.5 6.7,-18 6.7,-33.6 0.1,-15.7 -0.1,-16.4 -6.7,-29.7 -2,-3.9 -5.4,-8.5 -8.9,-11.8 -5.7,-5.5 -7.6,-6.4 -8.2,-4.2 z"
|
62
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
63
|
+
<path
|
64
|
+
d="m 768.8,181.2 c -7.6,7.2 -11.6,13.2 -14.9,23 -2.9,8.4 -3.1,30.1 -0.4,39.3 5.1,17.5 17.6,40.9 21.4,40.2 1.4,-0.2 5.4,-7.2 8,-13.7 2.2,-5.7 5.1,-21.5 5.1,-28 0,-7.7 -2.9,-24.7 -7.5,-43 -0.7,-3 -2.2,-9.1 -3.2,-13.4 -1.1,-4.4 -2.3,-8.1 -2.9,-8.3 -0.5,-0.2 -3,1.6 -5.6,3.9 z"
|
65
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
66
|
+
<path
|
67
|
+
d="m 59.6,251.7 c -1,1 -0.7,12.5 0.4,18.4 0.6,3 1.5,9 2,13.4 2.2,20.1 8,40.9 15.4,55.5 5.7,11.4 18.8,24.9 24.3,25 1.9,0 2.2,-0.7 2.9,-6.8 1.6,-15.4 -0.7,-41 -5.3,-57.2 -6.1,-21.9 -17.6,-39.3 -29.5,-44.8 -7.1,-3.2 -9.6,-4.1 -10.2,-3.5 z"
|
68
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
69
|
+
<path
|
70
|
+
d="m 819,252.6 c -8.7,2.8 -18.3,11.3 -24.3,21.3 -11.8,19.9 -18.4,52.9 -16.2,81.1 0.8,10.2 1.7,11 7.8,6.8 14.4,-10 23.3,-25.6 30,-52.3 2.8,-10.9 4.7,-21 4.7,-24 0,-1.7 0.7,-6.5 1.5,-10.8 0.8,-4.3 1.5,-11.2 1.5,-15.3 0,-7.8 -0.4,-8.3 -5,-6.8 z"
|
71
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
72
|
+
<path
|
73
|
+
d="m 151.5,300.7 c -13.2,16.6 -25.4,40.2 -30.8,59.3 -4.2,14.6 -4.7,17.9 -4.7,31.1 0,17.1 1.9,23.5 9.9,33.8 3.2,4.1 3.5,4.2 4.8,2.5 1.4,-1.9 17.3,-34.1 20.1,-40.4 0.8,-1.9 2.1,-4.8 2.8,-6.3 0.8,-1.6 1.4,-3.5 1.4,-4.4 0,-0.8 0.6,-2.7 1.4,-4.1 1.5,-2.9 3.5,-9.3 5.9,-18.7 3.9,-15.2 4.7,-29.2 2.3,-40.5 -1.4,-7 -6.1,-18 -7.7,-18 -0.5,0 -2.9,2.6 -5.4,5.7 z"
|
74
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
75
|
+
<path
|
76
|
+
d="m 724.3,297.7 c -3.9,5.9 -7.3,19.8 -7.3,29.3 0.1,9.6 3.6,28.6 6.6,35.8 0.8,1.8 1.4,3.9 1.4,4.7 0,0.8 0.6,2.9 1.4,4.7 0.8,1.8 2.4,5.8 3.6,8.8 6,15 22,47 23.5,47 2.7,0 8.9,-9.3 11.9,-17.8 1.5,-4.2 1.9,-8.3 1.8,-18.8 0,-14.2 -1.2,-21.1 -5.9,-34.9 -1.4,-3.9 -2.8,-8.4 -3.3,-10 -3.6,-11.7 -27.8,-51.5 -31.4,-51.5 -0.3,0 -1.4,1.2 -2.3,2.7 z"
|
77
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
78
|
+
<path
|
79
|
+
d="m 50.6,328.8 c -1.2,1.1 -0.6,20.7 1,31.1 1.9,13.4 4.2,25.3 6,31.1 2.6,8.7 5.4,17.1 6.3,18.8 4.5,8.9 6,11.6 9.7,17.3 4.5,6.8 19.7,22.2 23.7,23.9 1.2,0.6 4.1,2.2 6.5,3.6 6.2,3.6 7.4,2.8 6.6,-4.3 -1.7,-17.2 -8.6,-47.5 -14.1,-61.8 -0.8,-2.2 -2.2,-5.8 -3.1,-8 -1.8,-4.7 -4.8,-11.2 -6.5,-14 -7,-11.6 -11.1,-17.1 -17.1,-23.4 -7,-7.2 -17.9,-15.5 -19,-14.3 z"
|
80
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
81
|
+
<path
|
82
|
+
d="m 825,333.2 c -8.9,6.7 -13.2,11 -19.5,19.4 -12.6,16.6 -21.9,39.9 -27.9,69.4 -2.2,10.8 -4.4,23.7 -5,29.3 -0.7,6.3 0.6,6.7 8.1,2.6 12,-6.6 24.1,-18.5 32,-31.4 2.1,-3.4 8.3,-16.5 8.3,-17.5 0,-0.5 0.6,-2.4 1.4,-4.2 3.1,-7.2 6.4,-21.6 9.1,-39.5 1.6,-10.6 2.1,-31.9 0.8,-32.6 -0.5,-0.3 -3.7,1.8 -7.3,4.5 z"
|
83
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
84
|
+
<path
|
85
|
+
d="m 156.5,407.4 c -0.8,1.9 -1.5,4.7 -1.5,6.2 0,1.4 -0.8,5.4 -1.7,8.8 -2.5,9.4 -2.5,54.1 0,64.6 4.4,17.9 6.5,23.8 12.7,37 6,12.8 18.7,32 21.1,32 2.2,0 5,-7.9 6.9,-19.5 0.4,-2.8 1.3,-7 2.1,-9.5 2,-7.2 1.7,-45.7 -0.5,-54 -5.1,-19.5 -10.2,-32.5 -16.6,-42.5 -1.1,-1.7 -2.4,-3.9 -2.9,-5 -1.6,-3.3 -15.5,-20.8 -16.9,-21.3 -0.7,-0.2 -1.9,1.2 -2.7,3.2 z"
|
86
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
87
|
+
<path
|
88
|
+
d="m 717.2,411.7 c -6,7.5 -14.4,20.3 -16.3,24.7 -0.5,1.1 -1.3,2.8 -1.8,3.6 -3.6,6.1 -8.4,20.1 -11.7,33.9 -2.1,9 -2.4,44.7 -0.4,52.1 0.7,2.5 1.6,7 2.1,10 1.4,9.2 4.3,18.2 6.1,19.4 1.4,0.8 2.1,0.6 3.3,-0.9 1.9,-2.5 10.6,-15.4 12.1,-18 2.7,-4.6 11.4,-22.4 11.4,-23.4 0,-0.6 0.6,-2.5 1.4,-4.3 7.3,-17.2 10.5,-44.7 8.2,-70.3 -0.8,-8.8 -2,-17.6 -2.5,-19.5 -0.6,-1.9 -1.1,-4.8 -1.1,-6.5 0,-3.3 -1.9,-7.6 -3.6,-8.2 -0.6,-0.2 -3.9,3.1 -7.2,7.4 z"
|
89
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
90
|
+
<path
|
91
|
+
d="m 50.6,442.8 c -0.9,1.4 3.4,14.8 7.7,24.2 7.1,15.7 22.4,31 42.4,42.5 4.3,2.5 8.5,5 9.3,5.5 6.4,3.8 39.6,20 41.1,20 1.7,0 1.9,-0.5 1.4,-3.8 -1.1,-6.5 -3.6,-13.8 -8.2,-23.7 C 136.9,491.4 121.1,475.9 98.5,462.3 93.3,459.2 75,450.6 66,447 c -3,-1.1 -6.8,-2.8 -8.3,-3.6 -3.2,-1.6 -6.3,-1.8 -7.1,-0.6 z"
|
92
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
93
|
+
<path
|
94
|
+
d="m 825,443.7 c -1.9,0.9 -5,2.2 -6.7,2.9 -7.4,3.1 -10.5,4.4 -13.6,5.7 -4.8,2.1 -16.9,8.3 -20.8,10.6 -1.9,1.2 -4.1,2.4 -4.9,2.8 -1.4,0.6 -4.6,2.9 -13.5,9.5 -5.5,4.2 -17.5,16.9 -21,22.3 -3.9,6.2 -10.5,19.9 -10.5,21.9 0,0.7 -0.7,3 -1.5,4.9 -2,4.7 -2,10.7 -0.1,10.7 1.2,0 37.9,-18.2 46.6,-23.1 18.3,-10.4 34.6,-25 42.7,-38.4 5,-8.2 12.1,-28.4 10.8,-30.5 -0.9,-1.4 -3.4,-1.1 -7.5,0.7 z"
|
95
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
96
|
+
<path
|
97
|
+
d="m 73.6,520.9 c -0.6,0.9 0.3,4.2 1.3,5.1 0.3,0.3 1.7,2.1 3.1,4 12.2,17.5 35.9,39.9 52.5,49.6 2.7,1.6 5.9,3.4 7,4.1 1.1,0.7 3,1.7 4.3,2.3 1.3,0.5 4.6,2 7.5,3.3 14.6,6.7 28.5,10.3 47.7,12.7 10.8,1.3 11,1.3 11,-0.5 0,-2 -10.4,-17.8 -17.5,-26.5 -7.9,-9.6 -29,-28.8 -34.5,-31.3 -0.8,-0.4 -2.8,-1.6 -4.5,-2.7 -4.3,-2.7 -14.6,-8.1 -17.5,-9 -1.4,-0.5 -4.9,-1.8 -7.9,-2.9 C 117.9,526 105.7,523.3 94,522 75.3,520 74.2,519.9 73.6,520.9 z"
|
98
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
99
|
+
<path
|
100
|
+
d="m 802,520.6 c -28.5,2.6 -41.7,5.9 -60.5,15.1 -14.3,7.1 -23.7,13.7 -35.7,25.6 -14.2,13.9 -32.8,39 -30.6,41.3 0.8,0.7 18.4,-1.3 27.3,-3.2 15.7,-3.3 24.8,-6.5 39.5,-13.9 6.6,-3.3 20.6,-11.9 22,-13.5 0.3,-0.3 2.5,-2.1 5,-4 10.6,-8 24,-21.9 33.9,-35 7.7,-10.3 8.4,-11.7 6.5,-12.4 -0.9,-0.3 -2.1,-0.5 -2.7,-0.4 -0.7,0 -2.8,0.3 -4.7,0.4 z"
|
101
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
102
|
+
<path
|
103
|
+
d="m 209.6,524.7 c -1.9,2 2.3,27.3 6.5,39.8 0.6,1.6 1.5,4.3 1.9,6 1.8,6.3 7.4,20.1 10,24.5 0.5,0.8 2,3.6 3.4,6.2 3.2,5.9 9.1,15.1 10.8,16.9 0.7,0.8 3.3,3.9 5.8,6.9 8.9,10.8 21.7,22.3 34.1,30.3 5.9,3.9 7.8,4.5 8,2.4 1.2,-13.8 -4.2,-42.4 -11.2,-59.2 -2.2,-5.4 -8,-16.9 -9.9,-20 -1.1,-1.7 -2.3,-3.7 -2.7,-4.5 -1.6,-3.6 -10.3,-14.1 -17.7,-21.6 -7.4,-7.4 -23.5,-20.4 -25.2,-20.4 -0.4,0 -1.5,-0.6 -2.3,-1.4 -2.7,-2.3 -10.9,-6.5 -11.5,-5.9 z"
|
104
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
105
|
+
<path
|
106
|
+
d="m 669.5,526.1 c -1.6,1 -3.7,2.2 -4.5,2.6 -0.8,0.4 -3.5,2 -6,3.7 -16.4,10.9 -33,27.1 -41.6,40.6 -8,12.7 -16,30.5 -18.4,41 -0.4,1.9 -1.2,5.5 -1.8,8 -2.9,11.8 -4.2,20.8 -4.2,28.4 0,4.5 0.3,8.5 0.6,8.9 1.5,1.5 22.3,-14.1 32.9,-24.8 14.9,-14.9 24.3,-29.1 33.9,-51 8,-18.2 16.2,-55.5 13,-58.5 -0.5,-0.4 -2.2,0.1 -3.9,1.1 z"
|
107
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
108
|
+
<path
|
109
|
+
d="m 144.5,604.1 c -6.5,0.8 -12.9,2.9 -14.7,4.7 -0.7,0.7 -1.7,1.2 -2.3,1.2 -1.6,0 -5.5,4.3 -5.5,6.2 0,1.2 14.9,11.9 21,15.1 0.8,0.4 2.9,1.6 4.5,2.7 1.7,1.1 3.9,2.4 5,3 1.1,0.6 4.7,2.6 8,4.5 7.2,4.2 30.2,15.5 36.5,18 2.5,1 5.9,2.3 7.5,3 1.7,0.7 5.5,2 8.5,2.8 3,0.9 8.2,2.3 11.5,3.3 8.9,2.5 32.4,2.6 38.5,0 6.8,-2.8 7.5,-3.2 7.8,-4.9 0.4,-2 -12.6,-13.5 -28.6,-25.1 -3.4,-2.5 -6.4,-4.6 -6.6,-4.6 -0.3,0 -3.1,-1.7 -6.3,-3.8 -6.2,-4.2 -7.1,-4.7 -19,-10.5 -13.4,-6.7 -24.9,-11.3 -30.3,-12.4 -1.4,-0.3 -4.5,-1.1 -7,-1.8 -5.7,-1.7 -20.7,-2.4 -28.5,-1.4 z"
|
110
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
111
|
+
<path
|
112
|
+
d="m 719.5,604 c -7.7,0.8 -16.1,2.9 -24.5,6.1 -3,1.1 -6.7,2.4 -8.1,2.9 -1.4,0.4 -3.4,1.2 -4.5,1.8 -1,0.6 -5.3,2.7 -9.4,4.7 -18.5,9 -40.1,23.7 -55.5,37.8 -6.8,6.3 -6.8,7.8 0,10.4 16,6 43.6,2.7 69,-8.2 6.3,-2.8 17.1,-7.7 18.5,-8.5 0.8,-0.5 5.1,-2.7 9.5,-5 4.4,-2.2 9.4,-5 11,-6 1.7,-1.1 3.9,-2.4 5,-3 1.1,-0.6 3.4,-1.9 5,-3 1.7,-1.1 3.7,-2.3 4.5,-2.7 0.8,-0.4 4.3,-2.6 7.8,-5 3.5,-2.4 6.5,-4.3 6.8,-4.3 0.3,0 1.8,-1 3.4,-2.2 4.4,-3.2 3.9,-5.8 -1.9,-9.6 -2.8,-1.7 -5.5,-3.2 -6.1,-3.2 -0.6,0 -2.3,-0.6 -3.8,-1.4 -3.4,-1.7 -17.6,-2.6 -26.7,-1.6 z"
|
113
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
114
|
+
<path
|
115
|
+
d="m 305.5,607.5 c -0.5,0.2 -2.2,0.6 -3.7,0.9 -3.6,0.8 -3.6,3.3 -0.2,8.3 1.4,2.1 3,4.7 3.5,5.8 0.5,1.1 1.8,3.3 2.9,5 1.1,1.6 2.4,3.9 3,5 0.6,1.1 1.9,3.3 3,5 1.1,1.6 2.4,3.9 3,5 0.6,1.1 1.8,3.2 2.8,4.7 0.9,1.5 3.5,5.5 5.6,9 9.8,15.7 25.3,33.5 36.6,42.2 6.9,5.3 16.7,9.9 24.6,11.5 7.9,1.7 10.8,1.2 11.2,-1.7 0.5,-3.1 -3.1,-15 -7.3,-24.7 -3.9,-9 -5.9,-12.7 -10.7,-20.3 -1.6,-2.4 -2.8,-4.5 -2.8,-4.8 0,-0.3 -3.3,-4.9 -7.4,-10.2 -12.6,-16.5 -28.7,-30.6 -41.1,-36.1 -6.6,-2.9 -20,-5.6 -23,-4.6 z"
|
116
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
117
|
+
<path
|
118
|
+
d="m 564.5,609 c -10.5,2.7 -13.5,4.2 -25,12.7 -13,9.5 -26.9,25.5 -37.2,42.8 -2.1,3.5 -11,21.9 -12.6,26 -2.5,6.5 -5,17.2 -4.4,18.9 0.8,1.9 4.9,2 12.7,0.2 19.2,-4.2 39.3,-22.1 59.2,-52.6 4.1,-6.3 17.1,-27.7 18.1,-30 0.4,-0.8 1.6,-2.9 2.7,-4.5 1.1,-1.7 2.3,-3.7 2.7,-4.5 0.3,-0.8 1.4,-2.5 2.4,-3.8 2.4,-3.1 1.5,-4.9 -2.9,-6.2 -4.9,-1.3 -7.4,-1.2 -15.7,1 z"
|
119
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
120
|
+
<path
|
121
|
+
d="m 220.5,683 c -3.3,0.5 -9.1,1.4 -13,1.9 -23.2,3.4 -40.7,14.3 -47.2,29.3 -0.7,1.5 -0.9,2.9 -0.5,3.1 1.4,0.8 19.1,3.7 32.7,5.3 20,2.5 64.6,2.5 76.5,0 19.1,-3.9 33.4,-10 41.8,-17.9 5.6,-5.4 6.3,-7.1 3.3,-8.6 -4.1,-2.3 -21.6,-7 -34.6,-9.5 -18.7,-3.5 -47.8,-5.3 -59,-3.6 z"
|
122
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
123
|
+
<path
|
124
|
+
d="m 637,682.5 c -0.8,0.2 -6.9,0.9 -13.5,1.5 -11.4,1.1 -21.5,2.7 -31.5,5.2 -2.5,0.6 -6.1,1.4 -8,1.8 -7.8,1.8 -17,5.6 -17,7.1 0,1.3 7.1,8.5 11.5,11.5 3.9,2.6 14.1,7.5 18,8.5 1.7,0.4 4.4,1.2 6,1.7 1.7,0.6 7.3,1.9 12.5,2.8 13.1,2.5 55.5,2.5 75.5,0 16.1,-1.9 31.7,-4.6 32.8,-5.5 2.6,-2.3 -10.2,-18.4 -17.7,-22.1 -2.2,-1.2 -4.8,-2.5 -5.6,-2.9 -5.2,-3 -17.9,-6.5 -29.5,-8.1 -8.3,-1.1 -30.9,-2.2 -33.5,-1.5 z"
|
125
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
126
|
+
<path
|
127
|
+
d="m 341,719.6 c -12.2,2.1 -22.9,4.4 -27.5,6 -2.3,0.8 -4.8,1.4 -5.7,1.4 -1,0 -3.2,0.6 -5,1.4 -1.8,0.8 -5.3,2.2 -7.8,3.1 -32.4,12.6 -54.1,32.5 -56.5,51.9 -0.6,4.3 -0.4,5.6 0.6,5.6 2,0 24.1,-4 36.4,-6.6 3.9,-0.8 7.9,-1.4 9,-1.4 1.9,0 8.3,-1.3 22,-4.7 29.4,-7.1 51,-16.7 64.7,-28.9 8.4,-7.4 19.1,-23.5 17,-25.6 -3.7,-3.7 -30.4,-5 -47.2,-2.2 z"
|
128
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
129
|
+
<path
|
130
|
+
d="m 500,719.8 c -3,1 -5.5,2.2 -5.5,2.7 0,0.6 1.4,3.7 3,6.9 3.6,7.1 14.5,19.1 22,24.1 5.7,3.7 20.8,11.8 24.1,12.8 1,0.3 5.1,1.6 8.9,3 6.5,2.2 9.2,3 23.6,7.1 3.1,0.9 6.4,1.6 7.5,1.6 1,0 4.8,0.6 8.4,1.4 13.2,3 21.6,4.6 23.8,4.6 1.3,0 5.1,0.6 8.5,1.4 9.5,2.2 20.7,4 21.2,3.4 0.7,-0.7 -1.9,-11.4 -3.7,-15.3 -5.5,-12.2 -19.8,-25.8 -34.8,-33.4 -2.5,-1.2 -5.2,-2.6 -6,-3 -2.1,-1.2 -7.8,-3.6 -12.5,-5.4 -2.2,-0.8 -5.8,-2.1 -8,-3 -24.2,-8.9 -65.7,-13.5 -80.5,-8.9 z"
|
131
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
132
|
+
<path
|
133
|
+
d="m 422.5,740 c -3.3,1.7 -8.1,4.3 -10.7,5.8 -15.6,9.1 -28,23.9 -29,34.7 l -0.3,3 6.1,0.3 c 7.9,0.4 15.9,-3.2 22.6,-10 5.4,-5.5 9.9,-14.2 17.9,-34.6 1.1,-2.9 0.5,-2.8 -6.6,0.8 z"
|
134
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
135
|
+
<path
|
136
|
+
d="m 455,740.7 c 1.5,4.8 4,11.3 4.9,13.1 0.5,0.9 2,3.9 3.3,6.5 4.1,8.6 4.8,9.5 10.7,14.9 6.9,6.2 13.2,8.8 21.4,8.8 l 5.9,0 -0.7,-4 c -0.4,-2.2 -1.8,-5.9 -3.1,-8.3 -1.3,-2.3 -2.8,-5.1 -3.3,-6.2 -2.2,-5 -16.7,-16.6 -29.3,-23.4 -9.2,-5 -11,-5.2 -9.8,-1.4 z"
|
137
|
+
fill="#{USPSFlags::Config::GOLD}" />
|
138
|
+
</g>
|
139
|
+
SVG
|
140
|
+
end
|
141
|
+
end
|
138
142
|
end
|
139
143
|
end
|
140
144
|
end
|
@@ -4,61 +4,57 @@
|
|
4
4
|
#
|
5
5
|
# This class should never need to be called directly.
|
6
6
|
# @private
|
7
|
-
class USPSFlags
|
8
|
-
class
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
7
|
+
class USPSFlags
|
8
|
+
class Grades
|
9
|
+
class MeritMarks
|
10
|
+
class << self
|
11
|
+
def get(number)
|
12
|
+
return if number < 1
|
13
|
+
|
14
|
+
svg = +''
|
15
|
+
new_lines = 0
|
16
|
+
|
17
|
+
top_row = number % 20
|
18
|
+
svg << generate_top_row(top_row)
|
19
|
+
number -= top_row
|
20
|
+
|
21
|
+
number, new_lines, svg = add_row(number, new_lines, svg) while number.positive?
|
22
|
+
new_lines.times { svg << '</g>' }
|
23
|
+
|
24
|
+
svg
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def add_row(number, new_lines, svg)
|
30
|
+
number -= 20
|
31
|
+
new_lines += 1
|
32
|
+
svg << <<~SVG
|
33
|
+
<g transform="translate(0,90)">
|
34
|
+
#{generate_full_row}
|
35
|
+
SVG
|
36
|
+
|
37
|
+
[number, new_lines, svg]
|
38
|
+
end
|
39
|
+
|
40
|
+
def bar(offset = 0)
|
41
|
+
<<~SVG
|
42
|
+
<rect x="#{offset}" y="0" width="35" height="80" fill="#{USPSFlags::Config::GOLD}" />
|
43
|
+
SVG
|
44
|
+
end
|
45
|
+
|
46
|
+
def generate_top_row(number)
|
47
|
+
svg = +''
|
48
|
+
number.times { |i| svg << bar(45 * i) }
|
49
|
+
svg
|
50
|
+
end
|
51
|
+
|
52
|
+
def generate_full_row
|
53
|
+
svg = +''
|
54
|
+
20.times { |i| svg << bar(45 * i) }
|
55
|
+
svg
|
56
|
+
end
|
49
57
|
end
|
50
|
-
|
51
|
-
svg
|
52
|
-
end
|
53
|
-
|
54
|
-
def generate_full_row
|
55
|
-
svg = +''
|
56
|
-
|
57
|
-
20.times do |i|
|
58
|
-
svg << bar(45 * i)
|
59
|
-
end
|
60
|
-
|
61
|
-
svg
|
62
58
|
end
|
63
59
|
end
|
64
60
|
end
|
@@ -4,8 +4,8 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe USPSFlags::Grades do
|
6
6
|
describe 'invalid insignia' do
|
7
|
-
it '
|
8
|
-
@insignia =
|
7
|
+
it 'raises USPSFlags::Errors::InvalidInsignia if an invalid grade is specified' do
|
8
|
+
@insignia = described_class.new do |b|
|
9
9
|
b.grade = :not_a_grade
|
10
10
|
b.outfile = ''
|
11
11
|
end
|
@@ -15,8 +15,8 @@ describe USPSFlags::Grades do
|
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
18
|
-
it '
|
19
|
-
@insignia =
|
18
|
+
it 'raises USPSFlags::Errors::InvalidInsignia if an invalid edpro is specified' do
|
19
|
+
@insignia = described_class.new do |b|
|
20
20
|
b.edpro = nil
|
21
21
|
b.outfile = ''
|
22
22
|
end
|
@@ -26,8 +26,8 @@ describe USPSFlags::Grades do
|
|
26
26
|
)
|
27
27
|
end
|
28
28
|
|
29
|
-
it '
|
30
|
-
@insignia =
|
29
|
+
it 'raises USPSFlags::Errors::InvalidInsignia if an invalid membership is specified' do
|
30
|
+
@insignia = described_class.new do |b|
|
31
31
|
b.membership = :normal
|
32
32
|
b.outfile = ''
|
33
33
|
end
|
@@ -38,15 +38,15 @@ describe USPSFlags::Grades do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
context 'S' do
|
42
|
-
before
|
43
|
-
@insignia =
|
41
|
+
context 'with S' do
|
42
|
+
before do
|
43
|
+
@insignia = described_class.new do |g|
|
44
44
|
g.grade = :s
|
45
45
|
g.outfile = ''
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
it '
|
49
|
+
it 'has the S insignia' do
|
50
50
|
expect(@insignia.svg).to include(
|
51
51
|
<<~SVG
|
52
52
|
<g transform="translate(0, 50)">
|
@@ -56,15 +56,15 @@ describe USPSFlags::Grades do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
context 'P' do
|
60
|
-
before
|
61
|
-
@insignia =
|
59
|
+
context 'with P' do
|
60
|
+
before do
|
61
|
+
@insignia = described_class.new do |g|
|
62
62
|
g.grade = :p
|
63
63
|
g.outfile = ''
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
it '
|
67
|
+
it 'has the P insignia' do
|
68
68
|
expect(@insignia.svg).to include(
|
69
69
|
<<~SVG
|
70
70
|
<g transform="translate(0, 50)">
|
@@ -77,16 +77,16 @@ describe USPSFlags::Grades do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
context 'AP - EdPro' do
|
81
|
-
before
|
82
|
-
@insignia =
|
80
|
+
context 'with AP - EdPro' do
|
81
|
+
before do
|
82
|
+
@insignia = described_class.new do |g|
|
83
83
|
g.grade = :ap
|
84
84
|
g.edpro = true
|
85
85
|
g.outfile = ''
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
it '
|
89
|
+
it 'has the AP insignia' do
|
90
90
|
expect(@insignia.svg).to include(
|
91
91
|
<<~SVG
|
92
92
|
<g transform="translate(0, 50)">
|
@@ -114,7 +114,7 @@ describe USPSFlags::Grades do
|
|
114
114
|
)
|
115
115
|
end
|
116
116
|
|
117
|
-
it '
|
117
|
+
it 'has the AP EdPro bar' do
|
118
118
|
expect(@insignia.svg).to include(
|
119
119
|
<<~SVG
|
120
120
|
<rect x="0" y="100" width="381.25" height="20" fill="#FFBF3F" />
|
@@ -123,9 +123,9 @@ describe USPSFlags::Grades do
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
context 'JN - 5MM' do
|
127
|
-
before
|
128
|
-
@insignia =
|
126
|
+
context 'with JN - 5MM' do
|
127
|
+
before do
|
128
|
+
@insignia = described_class.new do |g|
|
129
129
|
g.grade = :jn
|
130
130
|
g.merit_marks = 5
|
131
131
|
g.edpro = true
|
@@ -133,7 +133,7 @@ describe USPSFlags::Grades do
|
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
it '
|
136
|
+
it 'has the JN insignia' do
|
137
137
|
expect(@insignia.svg).to include(
|
138
138
|
<<~SVG
|
139
139
|
<g transform="translate(0, 50)">
|
@@ -177,15 +177,15 @@ describe USPSFlags::Grades do
|
|
177
177
|
)
|
178
178
|
end
|
179
179
|
|
180
|
-
it '
|
180
|
+
it 'has a 5th position merit mark' do
|
181
181
|
expect(@insignia.svg).to include('<rect x="180" y="0" width="35" height="80" fill="#FFBF3F" />')
|
182
182
|
end
|
183
183
|
|
184
|
-
it '
|
185
|
-
expect(@insignia.svg).
|
184
|
+
it 'does not have a 6th position merit mark' do
|
185
|
+
expect(@insignia.svg).not_to include('<rect x="225" y="0" width="35" height="80" fill="#FFBF3F" />')
|
186
186
|
end
|
187
187
|
|
188
|
-
it '
|
188
|
+
it 'has the JN EdPro bar' do
|
189
189
|
expect(@insignia.svg).to include(
|
190
190
|
<<~SVG
|
191
191
|
<rect x="0" y="100" width="385" height="20" fill="#FFBF3F" />
|
@@ -194,16 +194,16 @@ describe USPSFlags::Grades do
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
context 'N - Life Member' do
|
198
|
-
before
|
199
|
-
@insignia =
|
197
|
+
context 'with N - Life Member' do
|
198
|
+
before do
|
199
|
+
@insignia = described_class.new do |g|
|
200
200
|
g.grade = :n
|
201
201
|
g.membership = :life
|
202
202
|
g.outfile = ''
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
206
|
-
it '
|
206
|
+
it 'has the N insignia' do
|
207
207
|
expect(@insignia.svg).to include(
|
208
208
|
<<~SVG
|
209
209
|
<g transform="translate(0, 50)">
|
@@ -265,7 +265,7 @@ describe USPSFlags::Grades do
|
|
265
265
|
)
|
266
266
|
end
|
267
267
|
|
268
|
-
it '
|
268
|
+
it 'has a life member arrow' do
|
269
269
|
expect(@insignia.svg).to include(
|
270
270
|
'm 107.6,178.2 c -0.2,0.7 -1.2,4.7 -2.1,8.8 -0.9,4.1 -2.2,9.7 -3,12.5 -7.9,29.7 -8.9,51.9 -2.9,67.7 4.5,' \
|
271
271
|
'12.2 7,16.7 8.9,16.7 2.4,0.1 12.2,-15.8 16.2,-26.4 6.4,-16.5 6.7,-18 6.7,-33.6 0.1,-15.7 -0.1,-16.4 -6.7,' \
|
@@ -274,9 +274,9 @@ describe USPSFlags::Grades do
|
|
274
274
|
end
|
275
275
|
end
|
276
276
|
|
277
|
-
context 'SN - Senior Member - 20 MM' do
|
278
|
-
before
|
279
|
-
@insignia =
|
277
|
+
context 'with SN - Senior Member - 20 MM' do
|
278
|
+
before do
|
279
|
+
@insignia = described_class.new do |g|
|
280
280
|
g.grade = :sn
|
281
281
|
g.membership = :senior
|
282
282
|
g.merit_marks = 20
|
@@ -284,12 +284,13 @@ describe USPSFlags::Grades do
|
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
287
|
-
it '
|
288
|
-
expect(@insignia.svg).to include(
|
289
|
-
|
287
|
+
it 'has the SN insignia box' do
|
288
|
+
expect(@insignia.svg).to include(
|
289
|
+
'<rect x="20" y="-10" width="730" height="155" fill="none" stroke-width="20"'
|
290
|
+
)
|
290
291
|
end
|
291
292
|
|
292
|
-
it '
|
293
|
+
it 'has a senior member arrow' do
|
293
294
|
expect(@insignia.svg).to include(
|
294
295
|
<<~SVG
|
295
296
|
<polyline points="0,250 75,220 75,240 150,240 150,260 75,260 75,280 0,250" fill="#FFBF3F" />
|
@@ -303,16 +304,16 @@ describe USPSFlags::Grades do
|
|
303
304
|
)
|
304
305
|
end
|
305
306
|
|
306
|
-
it '
|
307
|
+
it 'has a 20th position merit mark' do
|
307
308
|
expect(@insignia.svg).to include('<rect x="855" y="0" width="35" height="80" fill="#FFBF3F" />')
|
308
309
|
end
|
309
310
|
end
|
310
311
|
|
311
|
-
it '
|
312
|
-
expect(
|
312
|
+
it 'generates all without error' do
|
313
|
+
expect(described_class.all).to eql(USPSFlags::Grades::ALL_CONFIGS)
|
313
314
|
end
|
314
315
|
|
315
|
-
it '
|
316
|
+
it 'raises the correct error with an invalid edpro request' do
|
316
317
|
expect { USPSFlags::Grades::EdPro.get(:s) }.to raise_error(
|
317
318
|
USPSFlags::Errors::InvalidInsignia, 'EdPro is only valid for grades AP, JN, N'
|
318
319
|
)
|