Sha256: e97483afc8f41d09c0340da18b0cafd29338454d4e92c8eac61e339166f9396e

Contents?: true

Size: 487 Bytes

Versions: 2

Compression:

Stored size: 487 Bytes

Contents

module GridGenerator
  module Svg 
    class Polygon
      def initialize(points: , style:)
        @points = case points
                  when Array
                    points.map { |p| "#{p[0,0].round},#{p[1,0].round}" }.join(' ')
                  else
                    points
                  end
        @style = style
      end

      attr_reader :points, :style

      def to_svg
        "<polygon points=\"#{points}\" style=\"#{style.to_s}\" />"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grid_generator-0.3.3 lib/grid_generator/svg/polygon.rb
grid_generator-0.3.2 lib/grid_generator/svg/polygon.rb