forked from threedaymonk/battleship
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0e5c12
commit 7185777
Showing
3 changed files
with
37 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ def method_missing(m, *args) | |
end | ||
|
||
def kill | ||
@object.die(@secret) | ||
@object.stop(@secret) | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Battleship | ||
module Util | ||
PLAYER_METHODS = [:name, :new_game, :take_turn] | ||
|
||
def find_player_classes | ||
Module.constants. | ||
select { |sym| sym.to_s =~ /Player$/ }. | ||
map { |sym| Module.const_get(sym) }. | ||
select { |klass| | ||
(klass.instance_methods & PLAYER_METHODS) == PLAYER_METHODS | ||
} | ||
end | ||
end | ||
end |