usps_flags 0.4.0 → 0.4.1
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/Gemfile.lock +1 -1
- data/lib/usps_flags/core/trident_specs/base.rb +24 -0
- data/lib/usps_flags/core/trident_specs/circle.rb +9 -16
- data/lib/usps_flags/core/trident_specs/delta.rb +3 -27
- data/lib/usps_flags/core/trident_specs/long.rb +11 -27
- data/lib/usps_flags/core/trident_specs/short.rb +10 -21
- data/usps_flags.gemspec +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3d7ea83356a9fdf7e8b3ad5949e60462bcadbf2a98df05d270c2fc3875e5df7f
         | 
| 4 | 
            +
              data.tar.gz: 932d568a57b257d6dbd2e4ed595f11211e46597c0602e755559899f1c5548795
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1a320747b4cb6354667213bd5b5fef8a8f12b11d3fa6d406d8981381d6dfe2e08b622b83b52f4355cc27c88cf9117c85c88345a44baea78a5aedd92077713bc7
         | 
| 7 | 
            +
              data.tar.gz: dec6e9cf1c2dcc7d887d774bfaacd3e8a0db017fca0ce71f2aa4911f905d6dc9b759bd0d440a410f7d6ac904d01a10eae83087f38104b0cdfef150409c8f53dc
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -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 | 
            -
                 | 
| 10 | 
            -
             | 
| 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 | 
            -
             | 
| 19 | 
            -
                      #{inner_diameter} <!-- Inner circle diameter -->
         | 
| 20 | 
            -
                      #{outer_diameter} <!-- Outer circle diameter -->
         | 
| 21 | 
            -
                      #{circle_to_bottom} <!-- Circle to bottom -->
         | 
| 12 | 
            +
            private
         | 
| 22 13 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 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 | 
            -
                 | 
| 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  | 
| 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  | 
| 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 | 
            -
                 | 
| 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  | 
| 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 | 
            -
                 | 
| 21 | 
            -
                   | 
| 22 | 
            -
             | 
| 23 | 
            -
                    #{ | 
| 24 | 
            -
             | 
| 25 | 
            -
                    #{ | 
| 26 | 
            -
             | 
| 27 | 
            -
                    #{ | 
| 28 | 
            -
                   | 
| 29 | 
            -
                 | 
| 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. | 
| 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.'
         |