usps_flags 0.4.0 → 0.4.1

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
  SHA256:
3
- metadata.gz: 451c283ce311f5d823d989cddddce93a7b160239b472bd663d658c8b4e46be46
4
- data.tar.gz: 25258a07e6a71f51a2d0826836b48e454643afd568b6f17d1010056460b4d963
3
+ metadata.gz: 3d7ea83356a9fdf7e8b3ad5949e60462bcadbf2a98df05d270c2fc3875e5df7f
4
+ data.tar.gz: 932d568a57b257d6dbd2e4ed595f11211e46597c0602e755559899f1c5548795
5
5
  SHA512:
6
- metadata.gz: 9a019ca921c5b622c06e937f0b0e4dd047f60eed70a828775c14d22272eb44a798ee363aae4fd0ba079cedae03722289d1f3b10eb2329e68f2ed79f110886d35
7
- data.tar.gz: 650f1793ee7f310f9877cf4017361ce95e5468a9e53d623bd5425e002f179037a8811c5c90bbed9f852420d9873e1751fb0d6a279b35d2d0de455f79cbb73e33
6
+ metadata.gz: 1a320747b4cb6354667213bd5b5fef8a8f12b11d3fa6d406d8981381d6dfe2e08b622b83b52f4355cc27c88cf9117c85c88345a44baea78a5aedd92077713bc7
7
+ data.tar.gz: dec6e9cf1c2dcc7d887d774bfaacd3e8a0db017fca0ce71f2aa4911f905d6dc9b759bd0d440a410f7d6ac904d01a10eae83087f38104b0cdfef150409c8f53dc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps_flags (0.4.0)
4
+ usps_flags (0.4.1)
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)
@@ -11,5 +11,29 @@ class USPSFlags::Core::TridentSpecs::Base
11
11
 
12
12
  def initialize(options = {})
13
13
  @config = options[:config]
14
+ @box_top = options[:bt]
15
+ @box_bottom = options[:bb]
16
+ @box_left = options[:bl]
17
+ @box_right = options[:br]
18
+ @fly = options[:fly]
19
+ @unit = options[:unit]
20
+ @heading = options[:heading]
21
+ end
22
+
23
+ private
24
+
25
+ def output(name, x_offset, key)
26
+ body = block_given? ? yield : (boundary_box + right + left)
27
+
28
+ <<~SVG
29
+ <!-- #{name} Trident -->
30
+ <g transform="translate(#{BF * x_offset / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
31
+ #{@heading}
32
+
33
+ #{USPSFlags::Core::Icons::Trident.new(key).svg}
34
+
35
+ #{body}
36
+ </g></g>
37
+ SVG
14
38
  end
15
39
  end
@@ -6,27 +6,20 @@
6
6
  # @private
7
7
  class USPSFlags::Core::TridentSpecs::Circle < USPSFlags::Core::TridentSpecs::Long
8
8
  def p
9
- <<~SVG
10
- <!-- Circle Trident -->
11
- <g transform="translate(#{BF * 23 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
12
- #{@heading}
13
-
14
- #{USPSFlags::Core::Icons::Trident.new(:stf).svg}
15
-
16
- #{boundary_box}
9
+ output('Circle', 23, :stf)
10
+ end
17
11
 
18
- <!-- Right -->
19
- #{inner_diameter} <!-- Inner circle diameter -->
20
- #{outer_diameter} <!-- Outer circle diameter -->
21
- #{circle_to_bottom} <!-- Circle to bottom -->
12
+ private
22
13
 
23
- #{left_arrow}
24
- </g></g>
14
+ def right
15
+ <<~SVG
16
+ <!-- Right -->
17
+ #{inner_diameter} <!-- Inner circle diameter -->
18
+ #{outer_diameter} <!-- Outer circle diameter -->
19
+ #{circle_to_bottom} <!-- Circle to bottom -->
25
20
  SVG
26
21
  end
27
22
 
28
- private
29
-
30
23
  def inner_diameter
31
24
  <<~SVG
32
25
  #{SA.vertical(@box_right + @config[:bar_width], @box_top + @config[:crossbar_from_top] + @config[:bar_width] * 2, @box_top + @config[:crossbar_from_top] + @config[:width], @config[:center_point], @config[:center_point], fly: @fly, unit: @unit)} <!-- Inner circle diameter -->
@@ -5,32 +5,8 @@
5
5
  # This class should never need to be called directly.
6
6
  # @private
7
7
  class USPSFlags::Core::TridentSpecs::Delta < USPSFlags::Core::TridentSpecs::Base
8
- def initialize(options = {})
9
- super
10
- @box_top = options[:bt]
11
- @box_bottom = options[:bb]
12
- @box_left = options[:bl]
13
- @box_right = options[:br]
14
- @fly = options[:fly]
15
- @unit = options[:unit]
16
- @heading = options[:heading]
17
- end
18
-
19
8
  def p
20
- <<~SVG
21
- <!-- Delta Trident -->
22
- <g transform="translate(#{BF * 5 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
23
- #{@heading}
24
-
25
- #{USPSFlags::Core::Icons::Trident.new(:d).svg}
26
-
27
- #{boundary_box}
28
-
29
- #{right_arrow}
30
-
31
- #{left_arrow}
32
- </g></g>
33
- SVG
9
+ output('Delta', 5, :d)
34
10
  end
35
11
 
36
12
  private
@@ -42,7 +18,7 @@ private
42
18
  SVG
43
19
  end
44
20
 
45
- def right_arrow
21
+ def right
46
22
  <<~SVG
47
23
  <!-- Right -->
48
24
  #{gap_height} <!-- Delta gap height -->
@@ -59,7 +35,7 @@ private
59
35
  @box_bottom - @config[:delta_from_bottom] - @config[:bar_width] - @config[:delta_gap_height]
60
36
  end
61
37
 
62
- def left_arrow
38
+ def left
63
39
  <<~SVG
64
40
  <!-- Left -->
65
41
  #{SA.vertical(@box_left - @config[:bar_width] * 1.5, @box_top, @box_bottom, @box_left, @box_left, label_offset: -BF / 30, label_offset_y: -BF * 2 / 11, label_align: "middle", fly: @fly, unit: @unit)} <!-- Boundary height -->
@@ -5,35 +5,12 @@
5
5
  # This class should never need to be called directly.
6
6
  # @private
7
7
  class USPSFlags::Core::TridentSpecs::Long < USPSFlags::Core::TridentSpecs::Base
8
- def initialize(options = {})
9
- super
10
- @box_top = options[:bt]
11
- @box_bottom = options[:bb]
12
- @box_left = options[:bl]
13
- @box_right = options[:br]
14
- @fly = options[:fly]
15
- @unit = options[:unit]
16
- @heading = options[:heading]
17
- end
18
-
19
8
  def p
20
- <<~SVG
21
- <!-- Long Trident -->
22
- <g transform="translate(#{BF * 40 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
23
- #{@heading}
24
-
25
- #{USPSFlags::Core::Icons::Trident.new(:n).svg}
26
-
27
- #{boundary_box}
28
-
29
- <!-- Right -->
30
- #{hash_to_bottom} <!-- Hash to bottom -->
31
-
32
- #{left_arrow}
33
- </g></g>
34
- SVG
9
+ output('Long', 40, :n)
35
10
  end
36
11
 
12
+ private
13
+
37
14
  def boundary_box
38
15
  <<~SVG
39
16
  <!-- Boundary box -->
@@ -41,7 +18,14 @@ class USPSFlags::Core::TridentSpecs::Long < USPSFlags::Core::TridentSpecs::Base
41
18
  SVG
42
19
  end
43
20
 
44
- def left_arrow
21
+ def right
22
+ <<~SVG
23
+ <!-- Right -->
24
+ #{hash_to_bottom} <!-- Hash to bottom -->
25
+ SVG
26
+ end
27
+
28
+ def left
45
29
  <<~SVG
46
30
  <!-- Left -->
47
31
  #{SA.vertical(@box_left - @config[:bar_width] * 1.5, @box_top, @box_bottom, @box_left, @box_left, label_offset: -BF / 30, label_offset_y: -BF / 4.5, label_align: "middle", fly: @fly, unit: @unit)} <!-- Boundary height -->
@@ -5,28 +5,17 @@
5
5
  # This class should never need to be called directly.
6
6
  # @private
7
7
  class USPSFlags::Core::TridentSpecs::Short < USPSFlags::Core::TridentSpecs::Base
8
- def initialize(options = {})
9
- super
10
- @box_top = options[:bt]
11
- @box_bottom = options[:bb]
12
- @box_left = options[:bl]
13
- @box_right = options[:br]
14
- @fly = options[:fly]
15
- @unit = options[:unit]
16
- @heading = options[:heading]
17
- end
18
-
19
8
  def p
20
- <<~SVG
21
- <!-- Short Trident -->
22
- <g transform="translate(-#{BF * 14 / 80},#{BH * 9 / 32})"><g transform="scale(0.7)">
23
- #{@heading}
24
-
25
- #{USPSFlags::Core::Icons::Trident.new(:s).svg}
26
-
27
- #{boundary_box}#{right}#{left}#{bottom}#{top}#{overlay}
28
- </g></g>
29
- SVG
9
+ output('Short', 14, :s) do
10
+ <<~SVG
11
+ #{boundary_box}
12
+ #{right}
13
+ #{left}
14
+ #{bottom}
15
+ #{top}
16
+ #{overlay}
17
+ SVG
18
+ end
30
19
  end
31
20
 
32
21
  private
data/usps_flags.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'usps_flags'
5
- s.version = '0.4.0'
5
+ s.version = '0.4.1'
6
6
  s.date = '2019-05-30'
7
7
  s.summary = 'Flag generator for United States Power Squadrons'
8
8
  s.description = 'A flag image (PNG, SVG) generator for United States Power Squadrons.'
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander