lib/neo4j/active_node/scope.rb in neo4j-8.0.0.alpha.11 vs lib/neo4j/active_node/scope.rb in neo4j-8.0.0.alpha.12

- old
+ new

@@ -37,11 +37,11 @@ def scope(name, proc) scopes[name.to_sym] = proc klass = class << self; self; end klass.instance_eval do - define_method(name) do |query_params = nil, _ = nil| + define_method(name) do |*query_params| eval_context = ScopeEvalContext.new(self, current_scope || self.query_proxy) proc = full_scopes[name.to_sym] _call_scope_context(eval_context, query_params, proc) end end @@ -66,16 +66,11 @@ def full_scopes self.superclass.respond_to?(:scopes) ? self.superclass.scopes.merge(scopes) : scopes end def _call_scope_context(eval_context, query_params, proc) - if proc.arity == 1 - eval_context.instance_exec(query_params, &proc) - else - eval_context.instance_exec(&proc) - end + eval_context.instance_exec(*query_params.fill(nil, query_params.length..proc.arity - 1), &proc) end - def current_scope #:nodoc: ScopeRegistry.value_for(:current_scope, base_class.to_s) end