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
-
#assignments ⇒ AssignmentsCollection
Returns all local-variable assignments across every block.
-
#call_sites ⇒ CallSiteCollection
Returns all call sites found inside every block.
-
#return_expressions ⇒ ExpressionsCollection
Returns all return expressions across every block.
-
#returns ⇒ ReturnsCollection
Returns all return points across 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
#assignments ⇒ AssignmentsCollection
Returns all local-variable assignments across every block.
43 44 45 |
# File 'lib/rubyzen/collections/blocks_collection.rb', line 43 def assignments AssignmentsCollection.new(flat_map(&:assignments)) end |
#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 |
#return_expressions ⇒ ExpressionsCollection
Returns all return expressions across every block.
36 37 38 |
# File 'lib/rubyzen/collections/blocks_collection.rb', line 36 def return_expressions returns.expressions end |
#returns ⇒ ReturnsCollection
Returns all return points across every block.
29 30 31 |
# File 'lib/rubyzen/collections/blocks_collection.rb', line 29 def returns ReturnsCollection.new(flat_map(&:returns)) 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 |