From 0c76a52c472546083a199f685f96170031b36fdd Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Wed, 2 May 2012 23:57:52 +0100 Subject: clean up implementation of dynamic methods. use method compilation etc. --- .../lib/active_record/dynamic_scope_match.rb | 30 ---------------------- 1 file changed, 30 deletions(-) delete mode 100644 activerecord/lib/active_record/dynamic_scope_match.rb (limited to 'activerecord/lib/active_record/dynamic_scope_match.rb') diff --git a/activerecord/lib/active_record/dynamic_scope_match.rb b/activerecord/lib/active_record/dynamic_scope_match.rb deleted file mode 100644 index 6c043d29c4..0000000000 --- a/activerecord/lib/active_record/dynamic_scope_match.rb +++ /dev/null @@ -1,30 +0,0 @@ -module ActiveRecord - - # = Active Record Dynamic Scope Match - # - # Provides dynamic attribute-based scopes such as scoped_by_price(4.99) - # if, for example, the Product has an attribute with that name. You can - # chain more scoped_by_* methods after the other. It acts like a named - # scope except that it's dynamic. - class DynamicScopeMatch - METHOD_PATTERN = /^scoped_by_([_a-zA-Z]\w*)$/ - - def self.match(method) - if method.to_s =~ METHOD_PATTERN - new(true, $1 && $1.split('_and_')) - end - end - - def initialize(scope, attribute_names) - @scope = scope - @attribute_names = attribute_names - end - - attr_reader :scope, :attribute_names - alias :scope? :scope - - def valid_arguments?(arguments) - arguments.size >= @attribute_names.size - end - end -end -- cgit v1.2.3