Sha256: 2adb04cd7c26175fbd93c48beb7293dad09db083801ad8a4229b309b402cc211

Contents?: true

Size: 518 Bytes

Versions: 10

Compression:

Stored size: 518 Bytes

Contents

module CloudSesame
	module Query
		module DSL
			module ScopeAccessors

				def scopes(name = nil, *args)
					return _return if name.nil?

					defined_scopes = _scope.context[:scopes]
					if defined_scopes && (block = defined_scopes[name.to_sym])
						instance_exec *args, &block
						_return
					else
						raise Error::ScopeNotDefined
					end
				end

				private

				def method_missing(name, *args, &block)
					scopes name, *args
				rescue Error::ScopeNotDefined
					super
				end

			end
		end
	end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
CloudSesame-0.6.4 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.6.3 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.6.2 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.6.1 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.6.0 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.5.5 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.5.4 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.5.3 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.5.2 lib/cloud_sesame/query/dsl/scope_accessors.rb
CloudSesame-0.5.1 lib/cloud_sesame/query/dsl/scope_accessors.rb