class Draught::PathBuilder

Attributes

path[R]

Public Class Methods

build() { |builder| ... } click to toggle source
# File lib/draught/path_builder.rb, line 5
def self.build
  builder = new
  yield(builder)
  builder.send(:path)
end
connect(*paths) click to toggle source
# File lib/draught/path_builder.rb, line 11
def self.connect(*paths)
  paths = paths.reject(&:empty?)
  build { |p|
    p << paths.shift
    paths.inject(p.last) { |point, path|
      translation = Vector.translation_between(path.first, point)
      p << path.translate(translation)[1..-1]
      p.last
    }
  }
end
new() click to toggle source
# File lib/draught/path_builder.rb, line 26
def initialize
  @path = Path.new
end

Public Instance Methods

<<(path_or_point) click to toggle source
# File lib/draught/path_builder.rb, line 30
def <<(path_or_point)
  @path = path << path_or_point
  self
end
last() click to toggle source
# File lib/draught/path_builder.rb, line 35
def last
  path.last
end