Module: NsOptions::Proxy
- Defined in:
- lib/ns-options/proxy.rb
Defined Under Namespace
Modules: ProxyMethods
Constant Summary collapse
- NAMESPACE =
Mix this in to any module or class to make it proxy a namespace this means you can interact with the module/class/class-instance as if it were a namespace object itself.
"__proxy_options__"
Class Method Summary collapse
Class Method Details
.included(receiver) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ns-options/proxy.rb', line 13 def included(receiver) NsOptions::Helper.define_root_namespace_methods(receiver, NAMESPACE) receiver.class_eval { extend ProxyMethods } receiver.class_eval { include ProxyMethods } if receiver.kind_of?(Class) # default initializer method if receiver.kind_of?(Class) receiver.class_eval do def initialize(configs={}) self.apply(configs || {}) end end else # Module receiver.class_eval do def self.new(configs={}) self.apply(configs || {}) end end end end |