... 的集成开发环境(ide)下,在工程管理窗口中单击鼠标右健,选择 add module ( 添加模块 ) 或 add class module(添加类模块),便可将模块或类模块引入工程,当然,您也可以新建一个模块或类模块,编写代码,保存供以后..
基于4个网页-相关网页
在某些初始化代码中,打开ActiveRecord基类并添加acts_as _模块。
In some initialization code, open the ActiveRecord base class and add your acts_as_ module.
如果对横切关注点(例如日志和事务管理)进行了模块化,那么不用修改每个单独的类,就可以向代码中添加新特性。
If you modularize crosscutting concerns, such as logging and transaction management, it becomes possible to add new features to your code without modifying each class individually.
关于模块的一个好处就是可以将其功能附加到任何已有的ruby类,并且可以根据您的需要添加,没有数量限制。
The nice thing about a module is that you can attach its functionality to any existing Ruby class, and you can attach as many as you want.
应用推荐