Created
November 24, 2014 21:27
-
-
Save jheg/49e16f17300ae1be81dc to your computer and use it in GitHub Desktop.
mixin def init
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
module BJCard | |
attr_reader :value | |
def initialize | |
@value = card_value | |
end | |
def card_value | |
if (2..10).include?(face) | |
face | |
elsif face == 'A' | |
11 | |
else | |
face.to_i + 10 | |
end | |
end | |
end | |
class Card | |
include BJCard | |
attr_reader :face, :suit | |
def initialize(face, suit) | |
@face = face | |
@suit = suit | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment