k-tsj/pattern-match — pull request #1 by tokland (2013-03-12 13:19:50+00:00)
Title: Allow matching of object attributes with a hash matching

The library already supports matching with structs using the same arguments of the constructor. I propose a more general object matching using the same syntax used to match hashes, but instead of keys we would match accessors.

With the patch applied, this works:

```
require 'pattern-match'

class Person < Struct.new(:name, :age)
include PatternMatch::ObjectHashMatcher
end

match Person.new("John", 21) do
with Person.(:name, :age => 21) do
puts("name: #{name}")
end
end
```