Class: Hexflex::GridTriangle

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/hexflex/grid_triangle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#positionObject (readonly)

Returns the value of attribute position.



7
8
9
# File 'lib/hexflex/grid_triangle.rb', line 7

def position
  @position
end

#rowObject (readonly)

Returns the value of attribute row.



7
8
9
# File 'lib/hexflex/grid_triangle.rb', line 7

def row
  @row
end

#triangleObject (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

Returns:

  • (Boolean)


17
18
19
# File 'lib/hexflex/grid_triangle.rb', line 17

def first_row?
  row == 0
end

#second_row?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/hexflex/grid_triangle.rb', line 21

def second_row?
  row == 1
end