Class: Rubyzen::Collections::FileCollection
- Inherits:
-
BaseCollection
- Object
- Array
- BaseCollection
- Rubyzen::Collections::FileCollection
- Includes:
- Providers::CollectionFilterProvider
- Defined in:
- lib/rubyzen/collections/file_collection.rb
Overview
Collection of parsed file declarations. Serves as the top-level entry point for navigating into classes, modules, constants, and other code elements.
Instance Method Summary collapse
-
#blocks ⇒ BlocksCollection
Returns all block declarations across every file.
-
#call_sites ⇒ CallSiteCollection
Returns all call sites across every file.
-
#classes ⇒ ClassesCollection
Returns all class declarations across every file.
-
#constants ⇒ ConstantsCollection
Returns all constant declarations across every file.
-
#modules ⇒ ModulesCollection
Returns all module declarations across every file.
-
#requires ⇒ RequiresCollection
Returns all require/require_relative/load statements across every file.
-
#with_paths(*paths) ⇒ FileCollection
Filters files whose path includes any of the given substrings.
-
#without_paths(*paths) ⇒ FileCollection
Excludes files whose path includes any of the given substrings.
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
Instance Method Details
#blocks ⇒ BlocksCollection
Returns all block declarations across every file.
75 76 77 78 |
# File 'lib/rubyzen/collections/file_collection.rb', line 75 def blocks all_blocks = flat_map(&:blocks) BlocksCollection.new(all_blocks) end |
#call_sites ⇒ CallSiteCollection
Returns all call sites across every file.
67 68 69 70 |
# File 'lib/rubyzen/collections/file_collection.rb', line 67 def call_sites all_call_sites = flat_map(&:call_sites) CallSiteCollection.new(all_call_sites) end |
#classes ⇒ ClassesCollection
Returns all class declarations across every file.
35 36 37 38 |
# File 'lib/rubyzen/collections/file_collection.rb', line 35 def classes all_classes = flat_map(&:classes) ClassesCollection.new(all_classes) end |
#constants ⇒ ConstantsCollection
Returns all constant declarations across every file.
51 52 53 54 |
# File 'lib/rubyzen/collections/file_collection.rb', line 51 def constants all_constants = flat_map(&:constants) ConstantsCollection.new(all_constants) end |
#modules ⇒ ModulesCollection
Returns all module declarations across every file.
43 44 45 46 |
# File 'lib/rubyzen/collections/file_collection.rb', line 43 def modules all_modules = flat_map(&:modules) ModulesCollection.new(all_modules) end |
#requires ⇒ RequiresCollection
Returns all require/require_relative/load statements across every file.
59 60 61 62 |
# File 'lib/rubyzen/collections/file_collection.rb', line 59 def requires all_requires = flat_map(&:requires) RequiresCollection.new(all_requires) end |
#with_paths(*paths) ⇒ FileCollection
Filters files whose path includes any of the given substrings.
16 17 18 19 20 |
# File 'lib/rubyzen/collections/file_collection.rb', line 16 def with_paths(*paths) filter do |file_declaration| paths.any? { |p| file_declaration.path.include?(p) } end end |
#without_paths(*paths) ⇒ FileCollection
Excludes files whose path includes any of the given substrings.
26 27 28 29 30 |
# File 'lib/rubyzen/collections/file_collection.rb', line 26 def without_paths(*paths) filter do |file_declaration| !paths.any? { |p| file_declaration.path.include?(p) } end end |