module MetaInstance::ModuleExtensions
ModuleExtensions
provides some additional methods for Module and Class objects.
TODO: Are there any other module/class methods that need to be provided?
Public Instance Methods
method_definition(name)
click to toggle source
Get a first-class method definition object.
Returns an unbound method object. [UnboundMethod]
# File lib/meta_instance/module_extensions.rb, line 56 def method_definition(name) bind_call(:instance_method, name) end
Also aliased as: definition
method_definitions(*selection)
click to toggle source
List of method definitions in a module or class.
selection - Any of `:public`, `:protected` or `:private` which
is used to select specific subsets of methods.
Returns [Array<Symbol>]
# File lib/meta_instance/module_extensions.rb, line 29 def method_definitions(*selection) list = [] if selection.empty? list.concat bind_call(:instance_methods) end selection.each do |s| case s when :public, :all list.concat bind_call(:public_instance_methods) when :protected, :all list.concat bind_call(:protected_instance_methods) when :private, :all list.concat bind_call(:private_instance_methods) end end return list end
Also aliased as: definitions