Class: Cardistry::Card
- Inherits:
-
Object
- Object
- Cardistry::Card
- Defined in:
- lib/cardistry/card.rb
Constant Summary collapse
- @@suits =
[]
- @@kinds =
[]
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rank ⇒ Object
readonly
Returns the value of attribute rank.
-
#suit ⇒ Object
readonly
Returns the value of attribute suit.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rank, suit = nil, kind = :pip, name = nil) ⇒ Card
constructor
A new instance of Card.
- #to_s ⇒ Object
Constructor Details
#initialize(rank, suit = nil, kind = :pip, name = nil) ⇒ Card
Returns a new instance of Card.
8 9 10 11 12 13 |
# File 'lib/cardistry/card.rb', line 8 def initialize rank, suit = nil, kind = :pip, name = nil @rank = rank @suit = suit @kind = kind @name = name || default_name end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
3 4 5 |
# File 'lib/cardistry/card.rb', line 3 def kind @kind end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/cardistry/card.rb', line 3 def name @name end |
#rank ⇒ Object (readonly)
Returns the value of attribute rank.
3 4 5 |
# File 'lib/cardistry/card.rb', line 3 def rank @rank end |
#suit ⇒ Object (readonly)
Returns the value of attribute suit.
3 4 5 |
# File 'lib/cardistry/card.rb', line 3 def suit @suit end |
Class Method Details
.kinds ⇒ Object
19 20 21 |
# File 'lib/cardistry/card.rb', line 19 def self.kinds @@kinds end |
.suits ⇒ Object
15 16 17 |
# File 'lib/cardistry/card.rb', line 15 def self.suits @@suits end |
Instance Method Details
#to_s ⇒ Object
23 24 25 |
# File 'lib/cardistry/card.rb', line 23 def to_s @name end |