Sha256: 87e5b986ddc73f889254f02d9b12483e8b60b647b566dfd8c3c6cc32cbf05a49
Contents?: true
Size: 956 Bytes
Versions: 4
Compression:
Stored size: 956 Bytes
Contents
class Module # List all instance methods, equivalent to # # public_instance_methods + # protected_instance_methods + # private_instance_methods # # TODO: Better name for #all_instance_methods? # # CREDIT: Trans def all_instance_methods(include_super=true) public_instance_methods(include_super) + protected_instance_methods(include_super) + private_instance_methods(include_super) end # Query whether an instance method is defined for the module. # # CREDIT: Gavin Sinclair # CREDIT: Noah Gibbs def instance_method_defined?(meth) instance_methods_all(true).find{ |m| m == meth.to_s } end # Query whether a normal (singleton) method is defined for the module. # # CREDIT: Gavin Sinclair # CREDIT: Noah Gibbs def singleton_method_defined?(meth) singleton_methods(true).find{ |m| m == meth.to_s } end alias_method :module_method_defined?, :singleton_method_defined? end
Version data entries
4 entries across 4 versions & 1 rubygems