symbol_decoration:支持 Ruby 符号修饰,例如 where(

时间:2021-07-13 02:45:59
【文件属性】:
文件名称:symbol_decoration:支持 Ruby 符号修饰,例如 where(
文件大小:4KB
文件格式:ZIP
更新时间:2021-07-13 02:45:59
Ruby 符号装饰 Symbol Decoration gem 提供了符号方法扩展来实现 DSL,例如where(:field.in => [1,2,3]) 。 目标是允许不同的 ORM(例如 Mongoid 和 NoBrainer)共存,因为这两个 ORM 都需要此类功能。 用法 在以下示例中: where(:field.in => [1,2,3]) , in关键字是一个装饰器,用于装饰:field符号。 要注册装饰器,您可以调用Symbol::Decoration.register(decorator, ...) 。 例如: Symbol :: Decoration . register ( :in ) Symbol :: Decoration . register ( * %w( in nin eq ne not gt ge gte lt le lte ) ) 一旦注册,装饰器可以与
【文件预览】:
symbol_decoration-master
----Gemfile(77B)
----spec()
--------spec_helper.rb(175B)
--------symbol_decoration_spec.rb(3KB)
----.gitignore(13B)
----lib()
--------symbol_decoration.rb(1KB)
----README.md(2KB)
----nobrainer.gemspec(599B)

网友评论