Sha256: 68491890fdceff384749398c3b80b3a49b5b60fa55e66c7a7ef3211b0ebf8274

Contents?: true

Size: 575 Bytes

Versions: 5

Compression:

Stored size: 575 Bytes

Contents

module RecordFilter
  module ActiveRecordExtension
    module ClassMethods

      def filter(&block)
        Filter.new(self, nil, nil, &block)
      end

      def named_filter(name, &block)
        DSL::DSL::subclass(self).module_eval do
          define_method(name, &block)
        end

        (class << self; self; end).instance_eval do
          define_method(name.to_s) do |*args|
            Filter.new(self, name, nil, *args)
          end
        end
      end
    end
  end
end

ActiveRecord::Base.send(:extend, RecordFilter::ActiveRecordExtension::ClassMethods)

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
aub-record_filter-0.1.0 lib/record_filter/active_record.rb
aub-record_filter-0.1.1 lib/record_filter/active_record.rb
aub-record_filter-0.1.2 lib/record_filter/active_record.rb
outoftime-record_filter-0.1.0 lib/record_filter/active_record.rb
outoftime-record_filter-0.1.1 lib/record_filter/active_record.rb