Class: EightyOne::Faces::Direction

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/eighty-one/face.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(col, row) ⇒ Direction

Returns a new instance of Direction.



17
18
19
# File 'lib/eighty-one/face.rb', line 17

def initialize(col, row)
  @dir = [col, row]
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



15
16
17
# File 'lib/eighty-one/face.rb', line 15

def dir
  @dir
end

Instance Method Details

#eachObject



21
22
23
24
25
# File 'lib/eighty-one/face.rb', line 21

def each
  (1..8).each do |i|
    yield [@dir[0] * i, @dir[1] * i]
  end
end