summaryrefslogtreecommitdiffstats
path: root/CLI/ruby
diff options
context:
space:
mode:
authora14m <[email protected]>2020-12-08 13:43:37 +0100
committera14m <[email protected]>2020-12-08 13:43:37 +0100
commit7737bef237235883115c799fe8d9e3a7c55e42ec (patch)
tree0e5afe3b3e489493d3ee51d4d98273a3d05ee3b2 /CLI/ruby
parent26ae9530666ccea5815c4151c2088158450050ba (diff)
Fix error handling with exact namespaces (and required stdlibs)
Diffstat (limited to 'CLI/ruby')
-rw-r--r--CLI/ruby/lib/game_of_life/generators/input.rb5
-rw-r--r--CLI/ruby/lib/game_of_life/generators/seed.rb2
2 files changed, 4 insertions, 3 deletions
diff --git a/CLI/ruby/lib/game_of_life/generators/input.rb b/CLI/ruby/lib/game_of_life/generators/input.rb
index 3082e70..79626d4 100644
--- a/CLI/ruby/lib/game_of_life/generators/input.rb
+++ b/CLI/ruby/lib/game_of_life/generators/input.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require "open-uri"
+require "socket"
module GameOfLife
module Generators
@@ -22,9 +23,9 @@ module GameOfLife
# where any alpha numeric character is considered a living cell (true)
raw.map! { |row| row.chars.map { |char| char.match?(/[[:alnum:]]/) } }
populate(parsed_input: raw, width: options["width"].to_i, height: options["height"].to_i)
- rescue OpenURI::HTTPError, SocketError
+ rescue ::OpenURI::HTTPError, ::SocketError
raise GameOfLife::Error, "URL isn't avaialable, please check it again and make sure the URL is correct"
- rescue Errno::ENOENT
+ rescue ::Errno::ENOENT
raise GameOfLife::Error,
"File isn't avaialable, please check it again and make sure the path to the input file is correct"
end
diff --git a/CLI/ruby/lib/game_of_life/generators/seed.rb b/CLI/ruby/lib/game_of_life/generators/seed.rb
index 60be366..e64a28f 100644
--- a/CLI/ruby/lib/game_of_life/generators/seed.rb
+++ b/CLI/ruby/lib/game_of_life/generators/seed.rb
@@ -12,7 +12,7 @@ module GameOfLife
# @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, "Seed option isn't implemented yet, please use --input option"
+ fail ::NotImplementedError, "Seed option isn't implemented yet, please use --input option"
end
end
end