~mrlee/www.leemeichin.com

528717884fdbbf6a13204f07c7188b1fb723939d — Lee Meichin 2 months ago 4d1d7c2
Fix method naming
1 files changed, 2 insertions(+), 2 deletions(-)

M posts/ruby-sorcery.poly.pm
M posts/ruby-sorcery.poly.pm => posts/ruby-sorcery.poly.pm +2 -2
@@ 74,14 74,14 @@ You can deeply match any object in Ruby so long as you define a method to repres
This ◊code{PlayingCard} class is now capable of pattern matching.

◊codeblock['ruby]{
  def is_face?(playing_card)
  def face_card?(playing_card)
    case playing_card
    in { value: 'K' | 'Q' | 'J' } then true
    else false
    end
  end

  is_face?(PlayingCard.new(value: 3, colour: :red, suit: :spades))
  face_card?(PlayingCard.new(value: 3, colour: :red, suit: :spades))
  #=> false
}