Sha256: e9a883bd2a73c34bca223f1c69f88f86e9cd4017c80a1c17d95549d6f941eb52

Contents?: true

Size: 367 Bytes

Versions: 7

Compression:

Stored size: 367 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
        define_method(method_name, &lambda)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lazy_record-0.7.2 lib/lazy_record/scopes.rb
lazy_record-0.7.1 lib/lazy_record/scopes.rb
lazy_record-0.7.0 lib/lazy_record/scopes.rb
lazy_record-0.6.3 lib/lazy_record/scopes.rb
lazy_record-0.6.2 lib/lazy_record/scopes.rb
lazy_record-0.6.1 lib/lazy_record/scopes.rb
lazy_record-0.6.0 lib/lazy_record/scopes.rb