Sha256: e1c790ead3628db27f14048549dcb58c2cd99678fb4bb8becba40b00124dd911
Contents?: true
Size: 359 Bytes
Versions: 1
Compression:
Stored size: 359 Bytes
Contents
# frozen_string_literal: true require "fear" User = Struct.new(:id, :name, :admin) matcher = Fear.matcher do |m| m.xcase("User(_, name, true)") do |name:| puts "Hi #{name}, you are welcome" end m.xcase("User(_, _, false)") do puts "Only admins allowed here" end end matcher.(User.new(1, "Jane", true)) matcher.(User.new(1, "John", false))
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fear-1.1.0 | examples/pattern_extracting.rb |