lib/active_enumerable/scopes.rb in active_enumerable-0.1.1 vs lib/active_enumerable/scopes.rb in active_enumerable-0.2.0

- old
+ new

@@ -1,7 +1,8 @@ module ActiveEnumerable module Scopes + include ScopeMethod def method_missing(meth, *args, &block) if create_scope_method(meth) send(meth, *args, &block) else super @@ -19,18 +20,9 @@ def create_scope_method(meth) if (scope = self.class.__scoped_methods__.find { |a| a.first == meth }) self.define_singleton_method(scope.first) do scope(&scope.last) end - end - end - - def scope(&block) - result = instance_exec(&block) - if result.is_a? Array - __new_relation__(result) - else - result end end private :create_scope_method