usps_flags-grades 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/usps_flags/grades.rb +28 -6
- data/usps_flags-grades.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 271a447b5f4384d9153f4b836eb24f6502bf8ae10f276151871248c4c414176d
|
4
|
+
data.tar.gz: 2423607b8cfc2571c754f66c1da65075d1429bb31704644de4efc14f0a41fa4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271530863b761dde5a7c83a6b582071b3323b5285f16636ed503c9159ed3eb979b688a5f7e2a31da30274ad874ec0692879e517d4b591a58b08bdfed0514b870
|
7
|
+
data.tar.gz: ef7e8099916ed471b6d373924a237051a78d2b9ab87edc609884b0e8703eaf448923a3056029fd0814c9390652b2f44d0041846c830812421376c5db8f26d20b
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -18,6 +18,13 @@ insignia = USPSFlags::Grades.new do |g|
|
|
18
18
|
g.outfile = "/path/to/svg/output.svg"
|
19
19
|
end
|
20
20
|
|
21
|
+
insignia = USPSFlags::Grades.new(
|
22
|
+
grade: :sn,
|
23
|
+
membership: :senior,
|
24
|
+
merit_marks: 20,
|
25
|
+
outfile: "/path/to/svg/output.svg"
|
26
|
+
)
|
27
|
+
|
21
28
|
insignia.svg #=> Generates SVG file at "/path/to/svg/output.svg"
|
22
29
|
```
|
23
30
|
|
data/lib/usps_flags/grades.rb
CHANGED
@@ -9,6 +9,12 @@ class USPSFlags::Grades
|
|
9
9
|
require 'usps_flags/grades/edpro'
|
10
10
|
require 'usps_flags/grades/merit_marks'
|
11
11
|
|
12
|
+
ALL_CONFIGS ||= [
|
13
|
+
[:s, false, nil], [:p, false, nil], [:ap, false, nil], [:ap, true, nil],
|
14
|
+
[:jn, false, nil], [:jn, true, nil], [:n, false, nil], [:n, true, nil],
|
15
|
+
[:sn, false, nil], [nil, false, :senior], [nil, false, :life]
|
16
|
+
].freeze
|
17
|
+
|
12
18
|
# Constructor for generating grade insignia.
|
13
19
|
#
|
14
20
|
# @example Generate JN with EdPro and Senior Member
|
@@ -20,12 +26,12 @@ class USPSFlags::Grades
|
|
20
26
|
# end
|
21
27
|
#
|
22
28
|
# insignia.svg #=> Generates SVG file at "/path/to/svg/output.svg"
|
23
|
-
def initialize
|
24
|
-
@grade = nil
|
25
|
-
@edpro = false
|
26
|
-
@membership = nil
|
27
|
-
@merit_marks = 0
|
28
|
-
@outfile = nil
|
29
|
+
def initialize(options = {})
|
30
|
+
@grade = options[:grade] || nil
|
31
|
+
@edpro = options[:edpro] || false
|
32
|
+
@membership = options[:membership] || nil
|
33
|
+
@merit_marks = options[:merit_marks] || 0
|
34
|
+
@outfile = options[:outfile] || nil
|
29
35
|
@generated_at = Time.now.strftime("%Y%m%d.%H%S%z")
|
30
36
|
yield self if block_given?
|
31
37
|
end
|
@@ -73,6 +79,22 @@ class USPSFlags::Grades
|
|
73
79
|
"#{grade}#{edpro}#{membership}"
|
74
80
|
end
|
75
81
|
|
82
|
+
def self.all(dir = nil)
|
83
|
+
dir ||= USPSFlags.configuration.flags_dir
|
84
|
+
|
85
|
+
ALL_CONFIGS.each do |grade, edpro, membership|
|
86
|
+
path = "#{dir}/#{grade}"
|
87
|
+
path += '_edpro' if edpro
|
88
|
+
|
89
|
+
insignia = USPSFlags::Grades.new(
|
90
|
+
grade: grade, edpro: edpro, membership: membership,
|
91
|
+
outfile: "#{path}.svg"
|
92
|
+
)
|
93
|
+
|
94
|
+
USPSFlags::Generate.png(insignia.svg, outfile: "#{path}.png", trim: true)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
76
98
|
private
|
77
99
|
|
78
100
|
def validate
|
data/usps_flags-grades.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'usps_flags-grades'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2019-06-
|
3
|
+
s.version = '0.0.10'
|
4
|
+
s.date = '2019-06-02'
|
5
5
|
s.summary = 'Insignia generator for United States Power Squadrons'
|
6
6
|
s.description = 'An extension to the flag image (PNG, SVG) generator for United States Power Squadrons to generate grade insignia.'
|
7
7
|
s.homepage = 'http://rubygems.org/gems/usps_flags-grades'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usps_flags-grades
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: usps_flags
|