Sha256: c7863c7328d8c47d5e5341b556138662cc0b28193c23e163c65a8702a89841f5

Contents?: true

Size: 721 Bytes

Versions: 18

Compression:

Stored size: 721 Bytes

Contents

module GridGenerator
  module Svg 
    class Path 
      def initialize(d: , style:)
        @d = case d
             when String
               d
             when Array
               d.map(&:to_s).join(' ')
             else
               raise ArgumentError, "d must be String or Array" 
             end
        @style = case style
                 when GridGenerator::Svg::Style
                   style.to_s
                 when String
                   style
                 else
                   raise ArgumentError, "style must be String or Style" 
                 end
      end

      attr_reader :d, :style

      def to_svg
        "<path d=\"#{d}\" style=\"#{style}\" />"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
grid_generator-0.6.7 lib/grid_generator/svg/path.rb
grid_generator-0.6.6 lib/grid_generator/svg/path.rb
grid_generator-0.6.5 lib/grid_generator/svg/path.rb
grid_generator-0.6.4 lib/grid_generator/svg/path.rb
grid_generator-0.6.3 lib/grid_generator/svg/path.rb
grid_generator-0.6.2 lib/grid_generator/svg/path.rb
grid_generator-0.6.1 lib/grid_generator/svg/path.rb
grid_generator-0.6.0 lib/grid_generator/svg/path.rb
grid_generator-0.5.3 lib/grid_generator/svg/path.rb
grid_generator-0.5.2 lib/grid_generator/svg/path.rb
grid_generator-0.5.1 lib/grid_generator/svg/path.rb
grid_generator-0.5.0 lib/grid_generator/svg/path.rb
grid_generator-0.4.5 lib/grid_generator/svg/path.rb
grid_generator-0.4.4 lib/grid_generator/svg/path.rb
grid_generator-0.4.3 lib/grid_generator/svg/path.rb
grid_generator-0.4.2 lib/grid_generator/svg/path.rb
grid_generator-0.4.1 lib/grid_generator/svg/path.rb
grid_generator-0.4.0 lib/grid_generator/svg/path.rb