Module: QueryPackwerk::QueryInterface

Extended by:
T::Generic, T::Sig
Includes:
Enumerable, Kernel
Included in:
Packages, Violations
Defined in:
lib/query_packwerk/query_interface.rb

Overview

A mixin module providing a flexible query interface for collections. Implements methods for filtering, comparing, and manipulating collection data with a consistent API pattern. Extends included classes with class methods for advanced querying capabilities and integrates with Enumerable for additional collection functionality.

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

Elem =
type_member

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



59
60
61
# File 'lib/query_packwerk/query_interface.rb', line 59

def self.included(klass)
  klass.extend(ClassMethods)
end

Instance Method Details

#each(&block) ⇒ Object



32
33
34
35
36
# File 'lib/query_packwerk/query_interface.rb', line 32

def each(&block)
  return enum_for(:each) unless block_given?

  original_collection.each(&block)
end

#original_collectionObject



42
43
44
# File 'lib/query_packwerk/query_interface.rb', line 42

def original_collection
  []
end

#sizeObject Also known as: length, count



48
49
50
# File 'lib/query_packwerk/query_interface.rb', line 48

def size
  original_collection.size
end