Module: UtilityScopes::Except

Defined in:
lib/utility_scopes/except.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(within) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/utility_scopes/except.rb', line 4

def self.included(within)      
  within.class_eval do
    
    # Give every class the ability to add to itself the except named
    # scope
    extend ClassMethods
    
    # And automatically do so for all its subclasses
    def self.inherited_with_except_scope_hook(child)
      inherited_without_except_scope_hook(child)
      child.attach_except_utility_scope
    end
    class << self
      alias_method_chain :inherited, :except_scope_hook
    end
  end
end