Class: UserCard

Inherits:
Card
  • Object
show all
Defined in:
lib/99_game.rb

Overview

This class converts user input into a Card-like object

Constant Summary collapse

@@num =
{King: "King", K: "King", Ace: "Ace", A: "Ace", Queen: "Queen", Q: "Queen", Jack: "Jack", J: "Jack", Joker: "Joker", "$".to_sym => "Joker"}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Card

#_value, #value

Constructor Details

#initialize(number = "") ⇒ UserCard

Returns a new instance of UserCard.



29
# File 'lib/99_game.rb', line 29

def initialize(number=""); @@num.default, @num = number.to_i, @@num[number.capitalize.to_sym]; end

Instance Attribute Details

#numObject (readonly)

Returns the value of attribute num.



26
27
28
# File 'lib/99_game.rb', line 26

def num
  @num
end

Instance Method Details

#_numObject



28
# File 'lib/99_game.rb', line 28

def _num; @@num; end