Class: Card
- Inherits:
-
Object
- Object
- Card
- Defined in:
- lib/ninety_eight.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#num ⇒ Object
readonly
Returns the value of attribute num.
Instance Method Summary collapse
-
#initialize(card) ⇒ Card
constructor
A new instance of Card.
- #value ⇒ Object
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
#num ⇒ Object (readonly)
Returns the value of attribute num.
3 4 5 |
# File 'lib/ninety_eight.rb', line 3 def num @num end |
Instance Method Details
#value ⇒ Object
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 |