Skip to content

Instantly share code, notes, and snippets.

@jkutner
Created May 9, 2012 21:14
Show Gist options
  • Save jkutner/2648895 to your computer and use it in GitHub Desktop.
Save jkutner/2648895 to your computer and use it in GitHub Desktop.
Monkey patch Hash
class Hash
def method_missing(name, args, &block)
self[name]
end
end
rule [Hash, :m, where{ |h| h.lambda {|fact| fact[:key] == "hello"} }] do |vars|
# do stuff
end
rule [Hash, :h, f(:key, c{|h, k| h[k] == "hello"})] do |v|
# do stuff
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment