Class: Card

Inherits:
Object
  • Object
show all
Defined in:
lib/ninety_eight.rb

Direct Known Subclasses

UserCard

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card) ⇒ Card

Returns a new instance of Card.



4
# File 'lib/ninety_eight.rb', line 4

def initialize(card); @num = card; end

Instance Attribute Details

#numObject (readonly)

Returns the value of attribute num.



3
4
5
# File 'lib/ninety_eight.rb', line 3

def num
  @num
end

Instance Method Details

#valueObject



5
6
7
8
9
10
11
12
13
# File 'lib/ninety_eight.rb', line 5

def value
	case self.num
		when "Ace" then return 1
		when 2..9 then return self.num
		when 10 then return -10
		when "King" then return 98 #Sets value to 98
	else; return 0
	end
end