Class: Hexflex::GridTriangle
- Inherits:
-
Object
- Object
- Hexflex::GridTriangle
- Extended by:
- Forwardable
- Defined in:
- lib/hexflex/grid_triangle.rb
Instance Attribute Summary collapse
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#triangle ⇒ Object
readonly
Returns the value of attribute triangle.
Instance Method Summary collapse
- #first_row? ⇒ Boolean
-
#initialize(triangle:, row:, position:) ⇒ GridTriangle
constructor
A new instance of GridTriangle.
- #second_row? ⇒ Boolean
Constructor Details
#initialize(triangle:, row:, position:) ⇒ GridTriangle
Returns a new instance of GridTriangle.
11 12 13 14 15 |
# File 'lib/hexflex/grid_triangle.rb', line 11 def initialize(triangle:, row:, position:) @triangle = triangle @row = row @position = position end |
Instance Attribute Details
#position ⇒ Object (readonly)
Returns the value of attribute position.
7 8 9 |
# File 'lib/hexflex/grid_triangle.rb', line 7 def position @position end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
7 8 9 |
# File 'lib/hexflex/grid_triangle.rb', line 7 def row @row end |
#triangle ⇒ Object (readonly)
Returns the value of attribute triangle.
7 8 9 |
# File 'lib/hexflex/grid_triangle.rb', line 7 def triangle @triangle end |
Instance Method Details
#first_row? ⇒ Boolean
17 18 19 |
# File 'lib/hexflex/grid_triangle.rb', line 17 def first_row? row == 0 end |
#second_row? ⇒ Boolean
21 22 23 |
# File 'lib/hexflex/grid_triangle.rb', line 21 def second_row? row == 1 end |