I've been following an RSpec tutorial on Pluralsight for creating a basic card game. When the class is defined as such:
class Card
def initialize(suit:, rank:)
@suit = suit
@rank =
case rank
when :jack then 11
when :queen then 12
when :king then 13
else rank
end
end
end
the RSpec test code is for example:
RSpec.describe 'a playing card' do
it 'has a suit' do
raise unless Card.new(suit: :spades, rank: 4).suit == :spades
end
end
I haven't encountered method parameter syntax like this (suit: :spades, rank: 4)
. Can someone explain what this means, or point me in the right direction on where to look this up?