# Core SVG data for the US Ensign. # # This class should never need to be called directly. # @private class USPSFlags::Core::US def svg @base_hoist = 2000.to_f @base_fly = @base_hoist*1.91 @canton_hoist = @base_hoist*7/13 @canton_fly = @canton_hoist*Math.sqrt(2) @star_offset = 20 # Half of scaled star height svg = stripes svg << stars(:odd) svg << stars(:even) # star_diameter = base_hoist*4/5/13 # svg << <<~SVG # # SVG svg end private def stars(type = :odd) rows = { odd: (1..9).step(2).to_a, even: (2..8).step(2).to_a } columns = { odd: (1..11).step(2).to_a, even: (2..10).step(2).to_a } svg = "" rows[type].each do |r| columns[type].each do |c| svg << <<~SVG #{USPSFlags::Core::Star.new.svg} SVG end end svg end def stripes <<~SVG SVG end end