Sha256: 0352e48df1e95b0d3fdbcae0e5d9f3a042cc66f6e17308f17dfbf93ac735c915
Contents?: true
Size: 342 Bytes
Versions: 3
Compression:
Stored size: 342 Bytes
Contents
# frozen_string_literal: true require "fear" User = Struct.new(:id, :name, :admin) matcher = proc do |value| case value in User(admin: true, name:) puts "Hi #{name}, you are welcome" in User(admin: false) puts "Only admins are allowed here" end end matcher.(User.new(1, "Jane", true)) matcher.(User.new(1, "John", false))
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fear-3.0.0 | examples/pattern_extracting.rb |
fear-2.0.1 | examples/pattern_extracting.rb |
fear-2.0.0 | examples/pattern_extracting.rb |