lift:Ruby的哈希+块初始化

时间:2021-05-18 04:22:33
【文件属性】:
文件名称:lift:Ruby的哈希+块初始化
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-18 04:22:33
Ruby 电梯 微型库,用于通过散列初始化对象并将其自身屈服到块的常见模式。 在整个Ruby生态系统中,广泛重复了这种模式。 我在多个项目中重复了此代码,最终厌倦了它,所以请给力提! 安装 将此行添加到您的应用程序的Gemfile中: gem 'lift' 然后执行: $ bundle 或将其自己安装为: $ gem install lift 用法 class Person include Lift attr_accessor :name , :email end Person . new name : 'adam' , email : 'example@example.com' Person . new name : 'adam' do | adam | adam . email = 'example@example.com' end 注意:提升没有参数的super调
【文件预览】:
lift-master
----lift.gemspec(845B)
----LICENSE.txt(1KB)
----lib()
--------lift.rb(192B)
--------lift()
----Gemfile(89B)
----Rakefile(145B)
----.travis.yml(72B)
----test()
--------test_helper.rb(66B)
--------acceptance_test.rb(697B)
----README.md(1KB)
----.gitignore(185B)

网友评论