Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Fatty
- def self.included(base)
- base.extend(self)
- end
- def barr
- bazz
- end
- private
- def bazz
- puts "fat!!!"
- end
- end
- class Foo
- def self.bar
- baz
- end
- include Fatty
- private
- def self.baz
- puts "fat"
- end
- end
- Foo.bar #=> fat
- Foo.baz #=> fat
- Foo.barr #=> fat!!!
- Foo.bazz #=> NoMethodError: private method ‘bazz’ called for Foo:Class
Add Comment
Please, Sign In to add comment