Class: Cuprum::Collections::Basic::Scopes::NoneScope

Inherits:
Base show all
Includes:
Scopes::None
Defined in:
lib/cuprum/collections/basic/scopes/none_scope.rb

Overview

Scope for returning an empty data set.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Scopes::None

#and, #empty?, #invert, #not, #or, #type

Methods inherited from Scopes::Base

#==, #as_json, #debug, #empty?, #initialize, #invert, #type

Methods included from Scopes::Composition

#and, #not, #or

Constructor Details

This class inherits a constructor from Cuprum::Collections::Scopes::Base

Class Method Details

.instanceCuprum::Collections::Basic::Scopes::NoneScope

Returns a cached instance of the none scope.

Returns:



14
15
16
# File 'lib/cuprum/collections/basic/scopes/none_scope.rb', line 14

def self.instance
  @instance ||= new
end

Instance Method Details

#call(data:) ⇒ Object

Filters the provided data.

Raises:

  • (ArgumentError)


19
20
21
22
23
# File 'lib/cuprum/collections/basic/scopes/none_scope.rb', line 19

def call(data:)
  raise ArgumentError, 'data must be an Array' unless data.is_a?(Array)

  []
end

#match?(item:) ⇒ Boolean Also known as: matches?

Returns false for all items.

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/cuprum/collections/basic/scopes/none_scope.rb', line 26

def match?(item:)
  super

  false
end