X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/ddd5b4cf19a92582fd114914be5bd5a04d3522a7..3f607d565bc0e2c7b1b738301c11c16d069913d5:/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb new file mode 100644 index 000000000..5411b01bf --- /dev/null +++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb @@ -0,0 +1,23 @@ +class Game + attr_accessor :grid + def initialize(rows,cols) + @grid = Grid.new(rows, cols) + end + + def create_at(row,col) + @grid.create_at(row,col) + end + + def destroy_at(row,col) + @grid.destroy_at(row, col) + end + + def self.from_string(dots) + grid = Grid.from_string(dots) + game = new(grid.rows, grid.columns) + game.instance_eval do + @grid = grid + end + return game + end +end