Sha256: 501943229c8bc99a697954953dd6d3ad6df100914aa729f1a9840e5824dfdc7f
Contents?: true
Size: 636 Bytes
Versions: 3
Compression:
Stored size: 636 Bytes
Contents
require 'spyke/relation' require 'spyke/scope_registry' module Spyke module Scoping extend ActiveSupport::Concern module ClassMethods delegate :where, :build, to: :all def all current_scope || Relation.new(self, uri: uri) end def scope(name, code) define_singleton_method name, code end def current_scope=(scope) ScopeRegistry.set_value_for(:current_scope, name, scope) end def current_scope ScopeRegistry.value_for(:current_scope, name) end end private def scope @scope ||= self.class.all end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spyke-1.7.1 | lib/spyke/scoping.rb |
spyke-1.7.0 | lib/spyke/scoping.rb |
spyke-1.6.0 | lib/spyke/scoping.rb |