Module: Cuprum::Collections::Scopes::All

Included in:
Basic::Scopes::AllScope, AllScope
Defined in:
lib/cuprum/collections/scopes/all.rb

Overview

Functionality for implementing an all scope, which returns all data.

Instance Method Summary collapse

Instance Method Details

#and(hash = nil, &block) ⇒ Object #and(scope) ⇒ Object Also known as: where

Overloads:

  • #and(hash = nil, &block) ⇒ Object

    Parses the hash or block and returns the parsed scope.

    See Also:

    • Criteria::Parser#parse.
  • #and(scope) ⇒ Object

    Returns the given scope.



15
16
17
18
19
# File 'lib/cuprum/collections/scopes/all.rb', line 15

def and(*args, &)
  return self if scope?(args.first) && args.first.empty?

  builder.build(*args, &)
end

#empty?Boolean

Returns false.

Returns:

  • (Boolean)

    false.



23
24
25
# File 'lib/cuprum/collections/scopes/all.rb', line 23

def empty?
  false
end

#invertCuprum::Collections::Scopes::None

Returns a none scope for the current collection.

Returns:



29
30
31
# File 'lib/cuprum/collections/scopes/all.rb', line 29

def invert
  builder.build_none_scope
end

#or(hash = nil, &block) ⇒ Object #or(scope) ⇒ Object

Overloads:

  • #or(hash = nil, &block) ⇒ Object

    Parses the hash or block and returns the parsed scope.

    See Also:

    • Criteria::Parser#parse.
  • #or(scope) ⇒ Object

    Returns the given scope.



40
41
42
43
44
# File 'lib/cuprum/collections/scopes/all.rb', line 40

def or(*args, &)
  return self if scope?(args.first) && args.first.empty?

  builder.build(*args, &)
end

#typeSymbol

Returns the scope type.

Returns:

  • (Symbol)

    the scope type.



47
48
49
# File 'lib/cuprum/collections/scopes/all.rb', line 47

def type
  :all
end