Sha256: 9057b8b7ab58a48633a123b78659b4bc2b57d69237a19409017c3becc0671eef

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require "scopelist/version"

module Scopelist

  def self.included(base)
    base.class_eval do
      extend ClassMethods
      class << self
        alias_method_chain :scope, :scopelist
      end
    end
  end

  module ClassMethods
    def scope_with_scopelist(name, body, &block)
      additional_available_scope name
      scope_without_scopelist(name, body, &block)
    end

    def available_scopes
      @available_scopes ||= []
      @available_scopes.dup
    end

    def additional_available_scope(name)
      @available_scopes ||= []
      @available_scopes << name.to_sym
    end

  end
end

ActiveRecord::Base.send(:include, Scopelist)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scopelist-0.0.3 lib/scopelist.rb