Module: LazyRecord::Scopes
- Defined in:
- lib/lazy_record/scopes.rb
Overview
Add ActiveRecord-style scope macros to your classes. Allows chaining.
Constant Summary collapse
- SCOPE_MODULE_NAME =
:ScopeMethods
Instance Method Summary collapse
Instance Method Details
#lr_scope(method_name, lambda) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/lazy_record/scopes.rb', line 8 def lr_scope(method_name, lambda) extend mod = get_or_set_mod(SCOPE_MODULE_NAME) mod.module_eval do define_method(method_name, &lambda) end end |