An object model
Kernel Module
Kernel.private_instance_methods.grep (/^pr/)
Private method
1 If a method recipient is not your own, be sure to specify a recipient
2 Private methods can only specify one implied recipient (private method of the tunable superclass)
The class itself is an object of class. The name of the class is a constant
Class
Include module when M is inserted into the ancestor chain, just above the class
Two methods
Obj.send (: Method,arg) #动态派发 Ojb.method (ARG)
Module#define_method #动态方法 instead of Def
String#grep () {}
def method_missing (Method,*args)
Puts "you Called:#{method} (#{args.join (', ')}"
End
Three blocks
Kernel#local_variables () Tracking the name of the binding
Ruby Scopes do not look outside as nested inside java/c#
class definition, module definition, method call Close the previous scope
Instance_eval
Instance_exec Available Parameters
Packaging code
Proc Lambda
&proc represents a block of code
The return in proc indicates that it is returned from the defined scope
Lambda Ruturn represents the return in the lambda
Ruby Meta programming