`
java-admin
  • 浏览: 1365645 次
  • 性别: Icon_minigender_1
  • 来自: 陕西.西安
社区版块
存档分类
最新评论

alias 与 alias_method的区别

 
阅读更多

alias 与 alias_method的区别 (2009-7-14)

    1. alias是Ruby的一个关键字,而alias_method是Module类的一个方法
    2. alias的参数就是方法本身(method identify),注意,不是字符串,也不是Symbol,alias_method的参数则是字符串或者symbol,并且使用逗号分隔。
    3. alias_method可以重定义,而alias则不能

    alias new_method_name old_method_name
    alias_method :new_method_name, :old_method_name
    alias_method 'new_method_name', 'old_method_name'

分享到:
评论

相关推荐

    医疗病例数据信息(共1193条病例信息)

    case_alias(病例别名) case_medical_insurance(是否医保) case_infectivity(传染性) case_fre_occ_population(易感人群) case_related_symptoms(相关症状) case_dep_main(科室1) case_dep_sub(科室2) ...

    copy_method:实验性地将方法从一个类复制到另一个类。 这里有龙

    这个想法是最终允许元编程与Python装饰器一起使用,而不必过多使用alias_method等。 换句话说,保留super /继承/方法重写。 尽管它是非常非常具有实验性的,并且有一些警告,但是它大部分都可以工作。 与创建的方法...

    基于HTML爬虫的豆瓣小组API(Python版本).zip

    - json <url> <method> <params> - load - login <username> - logout - persist - req <url> <method> <params> <data> - toJSON - to_xml <content> - use - xml <url> <method> <params> - ...

    walker_method:Walker别名方法的Crystal实现,用于从具有给定概率分布的数组中快速采样

    walker_method:Walker别名方法的Crystal实现,用于从具有给定概率分布的数组中快速采样

    ruby元编程实际使用实例

    很喜欢ruby元编程,puppet和...rpc接口模板化——使用eval、alias、defind_method require 'rack/rpc' class Server < Rack> :hello_world end 上面是一个rpc server,编写一个函数,调用rpc命令进行注册。 采用define

    PowerShellPack

    About_alias.help.txt About_arithmetic_operators.help.txt About_array.help.txt About_assignment_operators.help.txt About_associative_array.help.txt About_automatic_variables.help.txt About_break.help....

    2015_07_08-module_prepend:Colin Kelley使用Ruby 2.1的Module#prepend进行面向方面的编程,2015年7月8日发表

    从一开始就使用#alias_method_chain在Ruby on Rails中几乎可以实现这种方法。 但是,该方法以分层分解而闻名。 Yehuda Katz写了一系列博客文章,提倡使用Module和#super更清洁的方法。 这种方法效果很好,但仅在...

    lodash underscore js库速查手册

    _.each(list, iterator, [context]) Alias: forEach Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is bound to the _.map(list, iterator, [context]) Alias: ...

    acpi控制笔记本风扇转速

    control method attempts to create 2 objects of the same name. This once again returns AE_ALREADY_EXISTS. When this exception occurs, it invokes the mechanism that will dynamically serialize the ...

    unidac_7_1_4_pro DELPHI 10 Tokyo

    Bug with processing a field with alias for query with the JOIN statement is fixed Bug with date and time fractional seconds precision when DescribeParams = True is fixed MySQL data provider Azure ...

    unidac_7_1_4_pro DELPHI 10 Berlin

    Bug with processing a field with alias for query with the JOIN statement is fixed Bug with date and time fractional seconds precision when DescribeParams = True is fixed MySQL data provider Azure ...

    SQL Prompt_9.0.2.3223破解版

    This build of SQL Prompt includes these improvements: ...SP-6715 : Missing space in alias definition. SP-6708 : XML Data Type Method reported as UDF See the full release notes for details.

    fbjni:一个旨在简化Java本机接口使用的库

    它可以与任何支持JNI的Java VM一起使用。 struct JMyClass : JavaClass<JMyClass> { static constexpr auto kJavaDescriptor = " Lcom/example/MyClass; " ; // Automatic inference of Java method descriptors...

    SQLPrompt_7.3.0.651(包含注册机)

    Fix for incorrectly qualifying a column using the xml "modify" method (Forum post) Fix for syntax error being introduced when wrapping long lines containing multi-line strings 7.3.0.619 - 17th October...

    MapView的使用

    keytool -list -alias androiddebugkey -keystore "C:\Documents and Settings\Administrator\Local Settings\Application Data\Android\debug.keystore" -storepass android -keypass android 结果如下:Microsoft ...

    ruby语法基础教程

    §3.8.1 alias 29 §3.8.2 undef 30 §3.8.3 defined? 31 第四章 基本类型 33 §4.1 Array 33 §4.2 Hash 34 §4.3 Number 34 §4.4 String 35 §4.5 Range 36 §4.6 Symbol 37 §4.7 正则表达式 37 第五章 代码块和...

    F5 GTM IControl 配置管理工具

    --wideipremovealias Remove Alias From WideIp,eg.(--wideipremovealias WideIpName,Alias) --wideipremovepool Remove A Pool From WideIp,eg.(--wideipremovepool WideIpName,PoolName,Order) --...

    msgpack-python-0.4.2.tar

    msgpack provides ``dumps`` and ``loads`` as alias for compatibility with ``json`` and ``pickle``. ``pack`` and ``dump`` packs to file-like object. ``unpack`` and ``load`` unpacks from file-like ...

    express-gettext:使用Gettext和PO文件的express.js转换模块

    它们在应用程序的“默认”语言环境中使用: app.setLocale -> Method to set the default localeapp.getLocale || app.locals.getLocale || app.getDefaultLocale -> Methods to get the default localeapp[alias] ...

Global site tag (gtag.js) - Google Analytics