Commit 7ec26d2

mo khan <mo@mokhan.ca>
2015-04-08 20:44:56
start to define path navigation.
1 parent 3aa864b
Changed files (2)
lib
scale
shapes
spec
lib/scale/shapes/path.rb
@@ -3,6 +3,10 @@ module Scale
     include Node
     attribute :d, String
 
+    def move_to(x:, y:)
+      self.d="M#{x} #{y}"
+    end
+
     def xml_tag
       :path
     end
spec/shapes/path_spec.rb
@@ -0,0 +1,10 @@
+describe Scale::Path do
+  it 'moves' do
+    subject.move_to(x: 10, y: 10)
+    expected = <<-XML
+<?xml version="1.0"?>
+<path d="M10 10"/>
+    XML
+    expect(subject.to_xml).to eql(expected)
+  end
+end