module Stones::Direction
Public Class Methods
all()
click to toggle source
# File lib/stones/direction.rb, line 19 def self.all [east, west, south, north] end
east()
click to toggle source
# File lib/stones/direction.rb, line 3 def east @east ||= -> (x, y) { [x+1, y] } end
north()
click to toggle source
# File lib/stones/direction.rb, line 11 def north @north ||= -> (x, y) { [x, y+1] } end
south()
click to toggle source
# File lib/stones/direction.rb, line 15 def south @south ||= -> (x, y) { [x, y-1] } end
west()
click to toggle source
# File lib/stones/direction.rb, line 7 def west @west ||= -> (x, y) { [x-1, y] } end
Private Instance Methods
east()
click to toggle source
# File lib/stones/direction.rb, line 3 def east @east ||= -> (x, y) { [x+1, y] } end
north()
click to toggle source
# File lib/stones/direction.rb, line 11 def north @north ||= -> (x, y) { [x, y+1] } end
south()
click to toggle source
# File lib/stones/direction.rb, line 15 def south @south ||= -> (x, y) { [x, y-1] } end
west()
click to toggle source
# File lib/stones/direction.rb, line 7 def west @west ||= -> (x, y) { [x-1, y] } end