Class: Card

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

Instance Method Summary collapse

Constructor Details

#initialize(h = {}) ⇒ Card

Returns a new instance of Card.



2
3
4
# File 'lib/cardtrick/card.rb', line 2

def initialize h={}
  @card = h
end

Instance Method Details

#cardObject



8
9
10
# File 'lib/cardtrick/card.rb', line 8

def card
  @card[:card]
end

#suitObject



11
12
13
# File 'lib/cardtrick/card.rb', line 11

def suit
  @card[:suit]
end

#to_iObject



14
15
16
# File 'lib/cardtrick/card.rb', line 14

def to_i
  @card[:value].to_i
end

#to_sObject



17
18
19
# File 'lib/cardtrick/card.rb', line 17

def to_s
  %[#{@card[:card]} of #{@card[:suit]}]
end

#valueObject



5
6
7
# File 'lib/cardtrick/card.rb', line 5

def value
  @card[:value]
end