Class: Rubyzen::Collections::ModulesCollection

Inherits:
BaseCollection show all
Includes:
Providers::CollectionFilterProvider
Defined in:
lib/rubyzen/collections/modules_collection.rb

Overview

Collection of module declarations with methods for navigating into child elements (methods, classes, constants).

Examples:

Getting all methods defined in modules

project.files.modules.all_methods

Instance Method Summary collapse

Methods included from Providers::CollectionFilterProvider

#with_name, #with_name_ending_with, #with_name_including, #with_name_starting_with, #without_name, #without_name_ending_with, #without_name_including, #without_name_starting_with

Methods inherited from BaseCollection

#filter

Instance Method Details

#all_methodsMethodsCollection

Returns all methods defined across every module.

Returns:



14
15
16
17
# File 'lib/rubyzen/collections/modules_collection.rb', line 14

def all_methods
  all_methods = flat_map(&:all_methods)
  MethodsCollection.new(all_methods)
end

#classesClassesCollection

Returns all class declarations nested inside every module.

Returns:



22
23
24
25
# File 'lib/rubyzen/collections/modules_collection.rb', line 22

def classes
  all_classes = flat_map(&:classes)
  ClassesCollection.new(all_classes)
end

#constantsConstantsCollection

Returns all constant declarations across every module.

Returns:



30
31
32
33
# File 'lib/rubyzen/collections/modules_collection.rb', line 30

def constants
  all_constants = flat_map(&:constants)
  ConstantsCollection.new(all_constants)
end