1. 首页
  2. 考试认证
  3. 其它
  4. charlatan ruby对象的简洁委托

charlatan ruby对象的简洁委托

上传者: 2024-10-06 16:58:43上传 ZIP文件 10.86KB 热度 1次
庸医将任何对象变成委托给另一个对象的代理。像那样: require 'charlatan' class ArrayProxy include Charlatan . new ( :array ) end array_proxy = ArrayProxy . new ( [ ] ) array_proxy < 'Hello' array_proxy < 'World' array_proxy . size # => 2 array_proxy . join ( ' ' ) # => 'Hello World' # always wraps responses with the proxy class other = array_proxy + [ 'Oh Hai' ] other . class # => ArrayProxy计划功能:对等式方法的可选支持对ki
下载地址
用户评论