class Dir2D

Constants

All
E
N
S
W

Public Class Methods

hori(length=1) click to toggle source
# File lib/cem/cruzzles.rb, line 261
def self.hori(length=1)
  return [E * (1..length), W * (1..length)].flatten
end
vert(length=1) click to toggle source
# File lib/cem/cruzzles.rb, line 257
def self.vert(length=1)
  return [N * (1..length), S * (1..length)].flatten
end
x(length=1) click to toggle source
# File lib/cem/cruzzles.rb, line 265
def self.x(length=1)
  return vert(length) + hori(length)
end

Public Instance Methods

*(other) click to toggle source

Dir2D * Range = array of Dir2D E * (1..3) = [E, E*2, E*3]

Calls superclass method
# File lib/cem/cruzzles.rb, line 249
def *(other)
  if other.is_a? Range
    other.to_a.map { |b| self * b }
  else
    super
  end  
end