~mrlee/www.kamelasa.dev

234061bfa7e2f355676345beb2c2c4a4721fa347 — Lee Meichin a month ago 9ea3faa
Simplify pattern guard example
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
@@ 137,12 137,12 @@ Building on the poker example, maybe it's valid to play the Joker, but only if t

◊codeblock['ruby]{
  def joker_allowed?
    Time.now.hour == 23
    true
  end
    
  def valid_call?(card)
    case card
    in [:Joker] if joker_allowed?
    in [:Joker, *] if joker_allowed?
      puts 'joker allowed'
      true
    else true