Module: WhereableScope::Mixin

Included in:
WhereableScope
Defined in:
lib/whereable_scope/mixin.rb

Instance Method Summary collapse

Instance Method Details

#own_whereable_scopesObject



16
17
18
# File 'lib/whereable_scope/mixin.rb', line 16

def own_whereable_scopes
  @whereable_scopes ||= {}
end

#whereable_scope(scope_name, as: nil) ⇒ Object



3
4
5
6
# File 'lib/whereable_scope/mixin.rb', line 3

def whereable_scope scope_name, as: nil
  as_value = as || scope_name
  own_whereable_scopes[as_value] = scope_name
end

#whereable_scopesObject



8
9
10
11
12
13
14
# File 'lib/whereable_scope/mixin.rb', line 8

def whereable_scopes
  if superclass.respond_to?(:whereable_scopes)
    superclass.whereable_scopes.merge(own_whereable_scopes)
  else
    own_whereable_scopes
  end
end