method_hooks:用于普通旧 Ruby 对象的 Rails 风格的方法挂钩

时间:2021-05-29 08:04:21
【文件属性】:
文件名称:method_hooks:用于普通旧 Ruby 对象的 Rails 风格的方法挂钩
文件大小:9KB
文件格式:ZIP
更新时间:2021-05-29 08:04:21
Ruby 方法钩子 允许您向任何方法添加before 、 around和after回调。 安装 将此行添加到您的应用程序的Gemfile中: gem 'method_hooks' 然后执行: $ bundle 或者自己安装: $ gem install method_hooks 用法 class Model extend MethodHooks before :save do puts 'before' end around :save do | method | puts 'before_around' method . call puts 'after_around' end after :save , :foo do puts 'after' end def save puts 'save' e
【文件预览】:
method_hooks-master
----LICENSE.txt(1KB)
----method_hooks.gemspec(1KB)
----lib()
--------method_hooks()
--------method_hooks.rb(3KB)
----Gemfile(97B)
----spec()
--------lib()
--------spec_helper.rb(4KB)
----Rakefile(29B)
----examples()
--------model.rb(426B)
----.travis.yml(70B)
----README.md(1KB)
----.rspec(30B)
----.gitignore(158B)

网友评论