# Core SVG data for the flag fields.
#
# This class should never need to be called directly.
# @private
class USPSFlags::Core::Field
def initialize(style: :regular, color: :white, fly: USPSFlags::Config::BASE_FLY)
@style = style
@fly = fly
case color
when :white
border = true
@color_code = "#FFFFFF"
@past_mid_color = USPSFlags::Config::BLUE
@past_tail_color = USPSFlags::Config::RED
when :red
border = false
@color_code = USPSFlags::Config::RED
@past_mid_color = "#FFFFFF"
@past_tail_color = USPSFlags::Config::BLUE
when :blue
border = false
@color_code = USPSFlags::Config::BLUE
@past_mid_color = "#FFFFFF"
@past_tail_color = USPSFlags::Config::RED
end
@border_svg = border ? "stroke=\"#000000\" stroke-width=\"#{USPSFlags::Config::BASE_FLY/600}\" " : ""
@hoist = (@fly * 2) / 3
end
def svg
case @style
when :regular
<<~FIELD
FIELD
when :swallowtail
<<~FIELD
FIELD
when :past
<<~FIELD
FIELD
end
end
end