Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/monkey_shield.rb
Instance Method Summary collapse
-
#__MONKEY__module_function__with_args(*methods) ⇒ Object
the singleton method which module_function creates should point to the original method, not the context wrapped one.
- #instance_method_visibility(method_name) ⇒ Object
Instance Method Details
#__MONKEY__module_function__with_args(*methods) ⇒ Object
the singleton method which module_function creates should point to the original method, not the context wrapped one
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/monkey_shield.rb', line 6 def __MONKEY__module_function__with_args(*methods) methods.each do |method| if unique_method_name = MonkeyShield::UNIQUE_METHOD_NAMES[ [self, method] ] __module_function__(unique_method_name) (class << self; self; end).class_eval { alias_method method, unique_method_name } else __module_function__(method) end end end |
#instance_method_visibility(method_name) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/monkey_shield.rb', line 28 def instance_method_visibility(method_name) if public_method_defined? method_name :public elsif protected_method_defined? method_name :protected elsif private_method_defined? method_name :private end end |