Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module MyModule
- module ClassMethods
- def modularize(opts = {})
- @opts = {:foo => "bar"}.merge opts #set defaults
- attr_reader :opts
- end
- end
- module InstanceMethods
- def opts
- self.class.opts
- end
- end
- end
- class MyClass
- extend MyModule::ClassMethods
- include MyModule::InstanceMethods
- modularize :foo => "jitsu"
- end
- MyClass.new.opts
Advertisement
Add Comment
Please, Sign In to add comment