module Is::Global
- public
-
Adds a global instance to any object.
Public Instance Methods
finalize()
click to toggle source
# File lib/is/global.rb, line 26 def finalize singleton_class.def_delegators(:global, *public_instance_methods(false) - singleton_class.public_instance_methods(false)) end
global()
click to toggle source
- public
-
Return the current global instance.
# File lib/is/global.rb, line 16 def global @__global ||= new end
method_added(name)
click to toggle source
Calls superclass method
# File lib/is/global.rb, line 32 def method_added(name) if instance_variable_defined?(:@__finalized) remove_instance_variable(:@__finalized) end super end
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/is/global.rb, line 40 def method_missing(name, *args, &block) unless defined?(@__finalized) finalize end if public_method_defined?(name) global.__send__(name, *args, &block) else super end end
reset()
click to toggle source
- public
-
Reset the global instance.
# File lib/is/global.rb, line 22 def reset remove_instance_variable(:@__global) if defined?(@__global) end
respond_to_missing?(name, *)
click to toggle source
Calls superclass method
# File lib/is/global.rb, line 56 def respond_to_missing?(name, *) public_method_defined?(name) || super end