Class: Cuprum::Collections::Basic::Scopes::NoneScope
- Inherits:
-
Base
- Object
- Scopes::Base
- Base
- Cuprum::Collections::Basic::Scopes::NoneScope
- 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 ⇒ Cuprum::Collections::Basic::Scopes::NoneScope
A cached instance of the none scope.
Instance Method Summary collapse
-
#call(data:) ⇒ Object
Filters the provided data.
-
#match?(item:) ⇒ Boolean
(also: #matches?)
Returns false for all items.
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
Constructor Details
This class inherits a constructor from Cuprum::Collections::Scopes::Base
Class Method Details
.instance ⇒ Cuprum::Collections::Basic::Scopes::NoneScope
Returns a cached instance of the none scope.
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.
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.
26 27 28 29 30 |
# File 'lib/cuprum/collections/basic/scopes/none_scope.rb', line 26 def match?(item:) super false end |