Sha256: 8fc8132445314bef1804c78f3e7459eb676ef83780fc983cbe6224f17e050ff9

Contents?: true

Size: 373 Bytes

Versions: 15

Compression:

Stored size: 373 Bytes

Contents

# frozen_string_literal: true

module LazyRecord
  # Add ActiveRecord-style scope macros to your classes. Allows chaining.
  module Scopes
    SCOPE_MODULE_NAME = :ScopeMethods

    def lr_scope(method_name, lambda)
      extend mod = get_or_set_mod(SCOPE_MODULE_NAME)
      mod.module_eval do
        send(:define_method, method_name, &lambda)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lazy_record-0.5.0 lib/lazy_record/scopes.rb
lazy_record-0.4.4 lib/lazy_record/scopes.rb
lazy_record-0.4.3 lib/lazy_record/scopes.rb
lazy_record-0.4.2 lib/lazy_record/scopes.rb
lazy_record-0.4.1 lib/lazy_record/scopes.rb
lazy_record-0.4.0 lib/lazy_record/scopes.rb
lazy_record-0.3.0 lib/lazy_record/scopes.rb
lazy_record-0.2.2 lib/lazy_record/scopes.rb
lazy_record-0.2.1 lib/lazy_record/scopes.rb
lazy_record-0.2.0 lib/lazy_record/scopes.rb
lazy_record-0.1.9 lib/lazy_record/scopes.rb
lazy_record-0.1.8 lib/lazy_record/scopes.rb
lazy_record-0.1.7 lib/lazy_record/scopes.rb
lazy_record-0.1.6 lib/lazy_record/scopes.rb
lazy_record-0.1.4 lib/lazy_record/scopes.rb