diff options
Diffstat (limited to 'CLI/ruby')
| -rw-r--r-- | CLI/ruby/.rubocop.yml | 3 | ||||
| -rw-r--r-- | CLI/ruby/lib/game_of_life/cell.rb | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CLI/ruby/.rubocop.yml b/CLI/ruby/.rubocop.yml index 59385a2..12f8fd8 100644 --- a/CLI/ruby/.rubocop.yml +++ b/CLI/ruby/.rubocop.yml @@ -11,6 +11,9 @@ Layout/LineLength: Style/AccessModifierDeclarations: EnforcedStyle: inline +Style/Alias: + EnforcedStyle: prefer_alias_method + Style/BlockDelimiters: Exclude: - 'spec/**/*' 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 |
