Class: MagicScopes::BooleanScopesGenerator

Inherits:
ScopesGenerator::Base show all
Includes:
PresenceScopes
Defined in:
lib/magic_scopes/scopes_generators/boolean.rb

Instance Method Summary collapse

Methods included from PresenceScopes

#with, #without

Methods inherited from ScopesGenerator::Base

#initialize, instance

Constructor Details

This class inherits a constructor from MagicScopes::ScopesGenerator::Base

Instance Method Details

#is(name) ⇒ Object



6
7
8
# File 'lib/magic_scopes/scopes_generators/boolean.rb', line 6

def is(name)
  scope name || @attr, where("#{@key}" => true)
end

#not(name) ⇒ Object



10
11
12
# File 'lib/magic_scopes/scopes_generators/boolean.rb', line 10

def not(name)
  scope name || "not_#{@attr}", where("#{@key}" => [false, nil])
end