惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
D
Docker
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
F
Full Disclosure
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
L
LangChain Blog
H
Help Net Security
B
Blog
T
Tailwind CSS Blog
V
V2EX
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
美团技术团队
A
About on SuperTechFans
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
I
InfoQ
Project Zero
Project Zero
I
Intezer
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threat Research - Cisco Blogs
Last Week in AI
Last Week in AI
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
S
Securelist
Recorded Future
Recorded Future
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 叶小钗
S
Security Affairs
Blog — PlanetScale
Blog — PlanetScale
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
The Hacker News
The Hacker News

博客园 - 阿飞外传

简单rails开发环境 关于MDA的长期等待 Is MOF the kernel language of MDA langs family graduated 语言内实例表示机制 类型信息隐藏 MOF自描述 图模式-续 符号软件工程(SSE) next MDA? Algebra operator declaration 's UML profile 应用元建模读书笔记 再谈实例化和图转换 EclipseUML2.0::Class的接口 主题与模型 MDA轮廓 UML::Element的代数规范 UML::InstanceValue是元类吗 MDA is a big reflection i need a job CGN的IP之父访谈的两句话 A sample of writing a loop in Action Semantic codes
ruby-core
阿飞外传 · 2006-09-21 · via 博客园 - 阿飞外传

包中的是ruby的核心类(算是M2+M3级)
外面的User是M1级。 虚线是instance_of关系
具有金穗带构架,Object.instance_of?(Class) = true, Class.ancestors.include?(Object) = true

不是很明白,中间杀出个程咬金:Module

总体原则是,核心类簇中继承链中的叶类作为实例化关系的祖先, 即Class

一些特征:
1)特定于某对象的方法(单例类实例的方法)
  str = "sdfsdf"
  def str.foo
    puts "a per object method"
  end

2)DSL特征,在Module类中增加方法,以便用户类在定义时调用。

class Module
  @@doc = {}
  def doc(str)
    @@doc[self.name] = str
  end
  def Moduel.doc(aClass)
    aClass = aClass.name if aClass.class <= Module
    @@doc[aClass]
  end
end

class User
  doc "here is the doc for user"
end
 
3)条件定义

def foo
  if $DEBUG
    def foo
      puts "debug version"
    end
   else
  end
end 

4)匿名类

class User
   @class_val = 123
   class <<self
     def aClassMethod
       puts @class_val
     end
   end
end