本月博客排行
年度博客排行
-
第1名
青否云后端云 -
第2名
zw7534313 -
第3名
大家都说我很棒 - liyihz2008
- wy_19921005
- gengyun12
- hbxflihua
- e_e
- luxurioust
- dbagirl
- zysnba
- robotmen
- Alsmile
- gaozzsoft
- jywhltj
- cpongo1
- leslie26
- qepwqnp
- 解宜然
- cuityang
- gashero
- sichunli_030
- fantaxy025025
- vipbooks
- wallimn
- gdpglc
- ssydxa219
- javashop
- ranbuijj
- jickcai
- hanbaohong
- johnsmith9th
- appalese
- gaojingsong
- weiyides
- 淡看人生
- java-007
- zhangyi0618
- AVI
- laiyangdeli
- liunancun
- xpenxpen
- zhangdaiscott
- 龙哥IT
- nychen2000
- conkeyn
- ouanui
- lemonhandsome
- silverend
- jveqi
最新文章列表
Metah.X: An XML Metaprogramming Language
Metah.X(简称MX)用自创的语法实现了XML Schema 1.0的语义,并且用C#实现了一个Schema-lized Document Object Model (SDOM),编译器编译MX代码后将生成使用SDOM的C#代码,这将XML Schema的语义映射到C#上,从而完全释放出XML Schema的力量。尽管现在只有C#版,实现Java版或其它语言版本是完全可能的。
MX是个开源项目, ...
关于method_missing 和respond_to?的基本用法
method_missing is a well-known tool in the Ruby metaprogramming toolbox. It’s callback method you can implement that gets called when a object tries to call a method that’s, well, missing. A well known ...
ruby 类方法,实例方法,单例方法
类方法只有类本身可以调用,在ruby中,类方法是一种特殊的单例方法
从上一篇eigenclass中可以得到这样的结论,eigenclass也是一种类,在ruby中所有的类又都是对象,对象都有对应的eigenclass。。。
【例1】
class C
def a_method
puts "C#a_method"
end
def ...
ruby metaprogramming examples
看附件吧。。。
Extracted from:
Metaprogramming Ruby
This PDF file contains pages extracted from Metaprogramming Ruby, published by the
Pragmatic Bookshelf. For more information or to purchase a paperba ...
Ruby Metaprogramming
Ruby使用者对attr_accessor一定不会陌生。
class A
attr_accessor :num
end
等效于:
class A
def num
@num
end
def =(value)
@num = value
...
Ruby的Singleton method
Ruby中,特定于某一对象的方法被称为Singleton method。
例如:
a = "string"
def a.run
puts "#{self} run"
end
str.run # =>#string run
...