summaryrefslogtreecommitdiffstats
path: root/CLI/ruby/lib
diff options
context:
space:
mode:
Diffstat (limited to 'CLI/ruby/lib')
-rw-r--r--CLI/ruby/lib/game_of_life/cell.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/CLI/ruby/lib/game_of_life/cell.rb b/CLI/ruby/lib/game_of_life/cell.rb
index a02ff4a..62cd3a1 100644
--- a/CLI/ruby/lib/game_of_life/cell.rb
+++ b/CLI/ruby/lib/game_of_life/cell.rb
@@ -4,6 +4,8 @@ module GameOfLife
class Cell
attr_accessor :alive, :pos_x, :pos_y
+ alias_method :alive?, :alive
+
# Initialize a cell in the game of life universe
# @param alive [True|False] boolean indicating if the cell is considered alive
# @param pos_x [Integer] the x position on the cyclic universe plane
@@ -18,7 +20,7 @@ module GameOfLife
# Both LIVE_CELL, and DEAD_CELL constant are defined on the application start from the options
# @return [String] if a cell is alive or an empty space
def to_s
- @alive ? LIVE_CELL : DEAD_CELL
+ alive? ? LIVE_CELL : DEAD_CELL
end
end
end