diff options
| author | a14m <[email protected]> | 2020-12-03 15:06:01 +0100 |
|---|---|---|
| committer | a14m <[email protected]> | 2020-12-03 15:07:49 +0100 |
| commit | 1404a38b5b6fbfe971729d24bd46e10b8d2da9fc (patch) | |
| tree | 831382d45a92ca4effb8f4a0410cbda209212a3f | |
| parent | 27b78771d819c4d9c1fe8537429d16fbc41d6a34 (diff) | |
Add the seed generator place holder class and test (and CLI error)
| -rwxr-xr-x | CLI/ruby/bin/game-of-life | 2 | ||||
| -rw-r--r-- | CLI/ruby/lib/game_of_life/generators/seed.rb | 20 | ||||
| -rw-r--r-- | CLI/ruby/spec/game_of_life/generators/seed_spec.rb | 10 |
3 files changed, 32 insertions, 0 deletions
diff --git a/CLI/ruby/bin/game-of-life b/CLI/ruby/bin/game-of-life index 28864ad..b490e1a 100755 --- a/CLI/ruby/bin/game-of-life +++ b/CLI/ruby/bin/game-of-life @@ -60,4 +60,6 @@ begin CLI.start(ARGV) rescue SystemExit, Interrupt "Do nothing when user exits with Interrupt (CMD/Ctrl + C)" +rescue NotImplementedError + puts "Seed option isn't implemented yet, please use --input option" end diff --git a/CLI/ruby/lib/game_of_life/generators/seed.rb b/CLI/ruby/lib/game_of_life/generators/seed.rb new file mode 100644 index 0000000..43dea04 --- /dev/null +++ b/CLI/ruby/lib/game_of_life/generators/seed.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module GameOfLife + module Generators + # Generate a new Universe/Board from a seed number + module Seed + class << self + # Generate a new Universe/Board from a seed number + # @param options [Hash] CLI options to generate initial conditions + # @option options [Numeric] "seed" number to use for generation + # @option options [Numeric] "width" (floored) and used as the width of the universe + # @option options [Numeric] "height" (floored) and used as the height of the universe + # @return [GameOfLife::Universe] populated with the parsed input + def new(options) + fail NotImplementedError + end + end + end + end +end diff --git a/CLI/ruby/spec/game_of_life/generators/seed_spec.rb b/CLI/ruby/spec/game_of_life/generators/seed_spec.rb new file mode 100644 index 0000000..17037e6 --- /dev/null +++ b/CLI/ruby/spec/game_of_life/generators/seed_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe GameOfLife::Generators::Seed do + describe ".new" do + it "raises NotImplementedError" do + options = { "seed" => 1337, "width" => 1, "height" => 1 } + expect { described_class.new(options) }.to raise_error(NotImplementedError) + end + end +end |
