Class: Rubyzen::Collections::BlocksCollection
- Inherits:
-
BaseCollection
- Object
- Array
- BaseCollection
- Rubyzen::Collections::BlocksCollection
- Includes:
- Providers::CollectionFilterProvider
- Defined in:
- lib/rubyzen/collections/blocks_collection.rb
Overview
Collection of block declarations (do…end / { }) found in files or methods.
Instance Method Summary collapse
-
#call_sites ⇒ CallSiteCollection
Returns all call sites found inside every block.
-
#with_method_name(method_name) ⇒ BlocksCollection
Filters blocks by the method name they are passed to.
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
#call_sites ⇒ CallSiteCollection
Returns all call sites found inside every block.
21 22 23 24 |
# File 'lib/rubyzen/collections/blocks_collection.rb', line 21 def call_sites all_call_sites = flat_map(&:call_sites) CallSiteCollection.new(all_call_sites) end |
#with_method_name(method_name) ⇒ BlocksCollection
Filters blocks by the method name they are passed to.
14 15 16 |
# File 'lib/rubyzen/collections/blocks_collection.rb', line 14 def with_method_name(method_name) filter { |block| block.method_name == method_name } end |