usps_flags 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffd7af5feab5e3c542c9593a56fba66daeee999b
4
- data.tar.gz: 07aeee695c11a2ec1c9d586531192a842d7a49f1
3
+ metadata.gz: 438531004f5629248e5cd73008ef140e8c9ad9fc
4
+ data.tar.gz: b2b586e3f878b8ea82d130e070b5ba5772b3587c
5
5
  SHA512:
6
- metadata.gz: 0210cd18bc48da7d8ec1760e6334b5fd27c1599435db6d27403a515e0553e493eba653ce7b29dc43b9348467d7cba7efd35199ad24a0a9d488a84a0b9283ae41
7
- data.tar.gz: 25ffd187580ea85831a9cb188bc3e7eaaae6efd1528c7c8986392bce905b35c4313241708e2ee700e230ddf1b442fe6d18a590e18ce069be0d2e895f434292a0
6
+ metadata.gz: b0d615902c4d3d28025abc36256bc45b778079fb4b8abec0e610c5acf57342a07db934eb52d840854f43d4bc0afaeba45dd597e5de5408ad9c2f2e3ed119b98c
7
+ data.tar.gz: ed64a81542097c27df2b1a33b8548a06884be94ff9987368704820b73c56391aafe1c48ea59cccd0f503937c04d9ec82b8bf1f877a7e11e8d313b9fdf9860f09
checksums.yaml.gz.sig CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps_flags (0.3.2)
4
+ usps_flags (0.3.3)
5
5
  file_utils (~> 1.1, >= 1.1.2)
6
6
  mini_magick (~> 4.8, >= 4.8.0)
7
7
  rubyzip (~> 1.2, >= 1.2.1)
@@ -34,7 +34,7 @@ class USPSFlags::Config
34
34
  #
35
35
  # All other values are derived from these, or directly from the constant sizes.
36
36
  #
37
- # @return [Hash] Returns the configuration values for tridents.
37
+ # @return [Hash] RThe configuration values for tridents.
38
38
  def self.trident
39
39
  point_height = USPSFlags::Config::BASE_FLY/48*17/8
40
40
  bar_width = USPSFlags::Config::BASE_FLY/48
@@ -71,6 +71,18 @@ class USPSFlags::Config
71
71
  }
72
72
  end
73
73
 
74
+ # Height values for trident insignia.
75
+ #
76
+ # @return [Hash] The height values for tridents.
77
+ def self.trident_heights
78
+ {
79
+ s: USPSFlags::Config::BASE_HOIST/2,
80
+ d: USPSFlags::Config::BASE_HOIST*5/8,
81
+ stf: USPSFlags::Config::BASE_HOIST*3/4,
82
+ n: USPSFlags::Config::BASE_HOIST*3/4
83
+ }
84
+ end
85
+
74
86
  # Accessor for the directory for storing generated flags.
75
87
  #
76
88
  # @return [String] The current path to the flags directory.
@@ -131,13 +143,4 @@ class USPSFlags::Config
131
143
  @@use_larger_tridents = @use_larger_tridents
132
144
  @@log_fail_quietly = @log_fail_quietly
133
145
  end
134
-
135
- def trident_heights
136
- {
137
- s: USPSFlags::Config::BASE_HOIST/2,
138
- d: USPSFlags::Config::BASE_HOIST*5/8,
139
- stf: USPSFlags::Config::BASE_HOIST*3/4,
140
- n: USPSFlags::Config::BASE_HOIST*3/4
141
- }
142
- end
143
146
  end
@@ -11,9 +11,9 @@ class USPSFlags::Core::Pennant
11
11
 
12
12
  def svg
13
13
  if @type == "OIC"
14
- svg = oic
14
+ oic
15
15
  elsif @type == "CRUISE"
16
- svg << <<~SVG
16
+ <<~SVG
17
17
  #{cruise}
18
18
  <g transform=\"translate(385, 340)\">
19
19
  #{USPSFlags::Core::Star.new.svg}
@@ -22,6 +22,7 @@ class USPSFlags::Core::Pennant
22
22
  end
23
23
  end
24
24
 
25
+ private
25
26
  def oic
26
27
  <<~SVG
27
28
  <polyline fill="#{USPSFlags::Config::BLUE}" points="0 0 #{USPSFlags::Config::BASE_FLY} #{USPSFlags::Config::BASE_HOIST/8} 0 #{USPSFlags::Config::BASE_HOIST/4}" />
@@ -4,57 +4,64 @@
4
4
  # @private
5
5
  class USPSFlags::Core::US
6
6
  def svg
7
- base_hoist = 2000.to_f
8
- base_fly = base_hoist*1.91
7
+ @base_hoist = 2000.to_f
8
+ @base_fly = @base_hoist*1.91
9
9
 
10
- canton_hoist = base_hoist*7/13
11
- canton_fly = canton_hoist*Math.sqrt(2)
10
+ @canton_hoist = @base_hoist*7/13
11
+ @canton_fly = @canton_hoist*Math.sqrt(2)
12
12
 
13
- star_offset = 20 # Half of scaled star height
13
+ @star_offset = 20 # Half of scaled star height
14
14
 
15
15
  svg = stripes
16
-
17
- [1,3,5,7,9].each do |r|
18
- [1,3,5,7,9,11].each do |c|
19
- svg << <<~SVG
20
- <g transform="translate(#{canton_fly*c/12}, #{star_offset+canton_hoist*r/10})"><g transform="scale(0.31)">#{USPSFlags::Core::Star.new.svg}</g></g>
21
- SVG
22
- end
23
- end
24
-
25
- [2,4,6,8].each do |r|
26
- [2,4,6,8,10].each do |c|
27
- svg << <<~SVG
28
- <g transform="translate(#{canton_fly*c/12}, #{star_offset+canton_hoist*r/10})"><g transform="scale(0.31)">#{USPSFlags::Core::Star.new.svg}</g></g>
29
- SVG
30
- end
31
- end
16
+ svg << stars(:odd)
17
+ svg << stars(:even)
32
18
 
33
19
  # star_diameter = base_hoist*4/5/13
34
20
  # svg << <<~SVG
35
- # <circle cx="#{canton_fly*6/12}" cy="#{canton_hoist*4/10-5}" r="#{star_diameter/2}" fill="#999999" fill-opacity="0.4" />
21
+ # <circle cx="#{@canton_fly*6/12}" cy="#{@canton_hoist*4/10-5}" r="#{star_diameter/2}" fill="#999999" fill-opacity="0.4" />
36
22
  # SVG
37
23
 
38
24
  svg
39
25
  end
40
26
 
41
27
  private
28
+ def stars(type = :odd)
29
+ rows = {
30
+ odd: (1..9).step(2).to_a,
31
+ even: (2..8).step(2).to_a
32
+ }
33
+ columns = {
34
+ odd: (1..11).step(2).to_a,
35
+ even: (2..10).step(2).to_a
36
+ }
37
+
38
+ svg = ""
39
+ rows[type].each do |r|
40
+ columns[type].each do |c|
41
+ svg << <<~SVG
42
+ <g transform="translate(#{@canton_fly*c/12}, #{@star_offset+@canton_hoist*r/10})"><g transform="scale(0.31)">#{USPSFlags::Core::Star.new.svg}</g></g>
43
+ SVG
44
+ end
45
+ end
46
+ svg
47
+ end
48
+
42
49
  def stripes
43
50
  <<~SVG
44
- <rect x="0" y="0" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
45
- <rect x="0" y="#{base_hoist*1/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
46
- <rect x="0" y="#{base_hoist*2/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
47
- <rect x="0" y="#{base_hoist*3/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
48
- <rect x="0" y="#{base_hoist*4/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
49
- <rect x="0" y="#{base_hoist*5/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
50
- <rect x="0" y="#{base_hoist*6/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
51
- <rect x="0" y="#{base_hoist*7/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
52
- <rect x="0" y="#{base_hoist*8/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
53
- <rect x="0" y="#{base_hoist*9/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
54
- <rect x="0" y="#{base_hoist*10/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
55
- <rect x="0" y="#{base_hoist*11/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
56
- <rect x="0" y="#{base_hoist*12/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
57
- <rect x="0" y="0" width="#{canton_fly}" height="#{canton_hoist}" fill="#{USPSFlags::Config::BLUE}" />
51
+ <rect x="0" y="0" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
52
+ <rect x="0" y="#{@base_hoist*1/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#FFFFFF" />
53
+ <rect x="0" y="#{@base_hoist*2/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
54
+ <rect x="0" y="#{@base_hoist*3/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#FFFFFF" />
55
+ <rect x="0" y="#{@base_hoist*4/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
56
+ <rect x="0" y="#{@base_hoist*5/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#FFFFFF" />
57
+ <rect x="0" y="#{@base_hoist*6/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
58
+ <rect x="0" y="#{@base_hoist*7/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#FFFFFF" />
59
+ <rect x="0" y="#{@base_hoist*8/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
60
+ <rect x="0" y="#{@base_hoist*9/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#FFFFFF" />
61
+ <rect x="0" y="#{@base_hoist*10/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
62
+ <rect x="0" y="#{@base_hoist*11/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#FFFFFF" />
63
+ <rect x="0" y="#{@base_hoist*12/13}" width="#{@base_fly}" height="#{@base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
64
+ <rect x="0" y="0" width="#{@canton_fly}" height="#{@canton_hoist}" fill="#{USPSFlags::Config::BLUE}" />
58
65
  SVG
59
66
  end
60
67
  end
data/usps_flags.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'usps_flags'
3
- s.version = '0.3.3'
3
+ s.version = '0.3.4'
4
4
  s.date = '2017-11-06'
5
5
  s.summary = 'Flag generator for United States Power Squadrons'
6
6
  s.description = 'A flag image (PNG, SVG) generator for United States Power Squadrons.'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps_flags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- V���I��.MN�����j�� GL��y�y��O�9�ԳR���ɓB�?'����)�)��] ���(
2
- k&Wh40�օ5��0ź��;<�;%�|a��m�<�47�9���_��
3
- �^���c9
1
+ '
2
+ �}����~�R�0�*y,dQ���)c�oH�8�p>���]����>ʗ��`'�h�h�E��D& ;�.ڲ82��H���*��u��>���zW_��