Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ruby-1.9.2-p180 :004 > class A
- ruby-1.9.2-p180 :005?> def ===(other)
- ruby-1.9.2-p180 :006?> puts "A#===(#{other.inspect}) called"
- ruby-1.9.2-p180 :007?> end
- ruby-1.9.2-p180 :008?> end
- => nil
- ruby-1.9.2-p180 :009 > class B
- ruby-1.9.2-p180 :010?> def ===(other)
- ruby-1.9.2-p180 :011?> puts "B#===(#{other.inspect}) called"
- ruby-1.9.2-p180 :012?> end
- ruby-1.9.2-p180 :013?> end
- => nil
- ruby-1.9.2-p180 :014 > case A.new
- ruby-1.9.2-p180 :015?> when B.new
- ruby-1.9.2-p180 :016?> end
- B#===(#<A:0xa2e7930>) called
- => nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement