Class: Method
Instance Method Summary (collapse)
-
- ==
Two method objects are equal if they are bound to the same object and refer to the same method definition.
-
- []
Invokes the meth with the specified arguments, returning the method's return value.
-
- arity
Returns an indication of the number of arguments accepted by a method.
-
- call
Invokes the meth with the specified arguments, returning the method's return value.
-
- clone
MISSING: documentation.
-
- ==
Two method objects are equal if they are bound to the same object and refer to the same method definition.
-
- hash
Returns a hash value corresponding to the method object.
-
- inspect
Returns the name of the underlying method.
-
- name
Returns the name of the method.
-
- owner
Returns the class or module that defines the method.
-
- receiver
Returns the bound receiver of the method object.
-
- to_proc
Returns a Proc object corresponding to this method.
-
- to_s
Returns the name of the underlying method.
-
- unbind
Dissociates meth from its current receiver.
Methods inherited from NSObject
#!, #!=, #!~, #, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Method Details
- (Boolean) ==(other_meth)
Two method objects are equal if they are bound to the same object and refer to the same method definition.
- (Object) call(args, ...) - (Object) [](args, ...)
Invokes the meth with the specified arguments, returning the method's return value.
m = 12.method("+")
m.call(3) #=> 15
m.call(20) #=> 32
- (Fixnum) arity
Returns an indication of the number of arguments accepted by a method. Returns a nonnegative integer for methods that take a fixed number of arguments. For Ruby methods that take a variable number of arguments, returns -n-1, where n is the number of required arguments. For methods written in C, returns -1 if the call takes a variable number of arguments.
class C
def one; end
def two(a); end
def three(*a); end
def four(a, b); end
def five(a, b, *c); end
def six(a, b, *c, &d); end
end
c = C.new
c.method(:one).arity #=> 0
c.method(:two).arity #=> 1
c.method(:three).arity #=> -1
c.method(:four).arity #=> 2
c.method(:five).arity #=> -3
c.method(:six).arity #=> -3
"cat".method(:size).arity #=> 0
"cat".method(:replace).arity #=> 1
"cat".method(:squeeze).arity #=> -1
"cat".method(:count).arity #=> -1
- (Object) call(args, ...) - (Object) [](args, ...)
Invokes the meth with the specified arguments, returning the method's return value.
m = 12.method("+")
m.call(3) #=> 15
m.call(20) #=> 32
- (Object) clone
MISSING: documentation
- (Boolean) ==(other_meth)
Two method objects are equal if they are bound to the same object and refer to the same method definition.
- (Integer) hash
Returns a hash value corresponding to the method object.
- (String) to_s - (String) inspect
Returns the name of the underlying method.
"cat".method(:count).inspect #=> "#<Method: String#count>"
- (Symbol) name
Returns the name of the method.
- (Object) owner
Returns the class or module that defines the method.
- (Object) receiver
Returns the bound receiver of the method object.
- (String) to_s - (String) inspect
Returns the name of the underlying method.
"cat".method(:count).inspect #=> "#<Method: String#count>"
- (UnboundMethod) unbind
Dissociates meth from its current receiver. The resulting UnboundMethod can subsequently be bound to a new object of the same class (see UnboundMethod).