Class: EightyOne::Faces::Direction
- Inherits:
-
Object
- Object
- EightyOne::Faces::Direction
- Includes:
- Enumerable
- Defined in:
- lib/eighty-one/face.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(col, row) ⇒ Direction
constructor
A new instance of Direction.
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
#dir ⇒ Object (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
#each ⇒ Object
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 |