Class: Rubyzen::Collections::ExpressionsCollection

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

Overview

Collection of Declarations::ExpressionDeclaration — return values, call arguments, and other value-expressions.

Examples:

method.return_expressions.hash_literals

Direct Known Subclasses

ArgumentsCollection

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

#constantsExpressionsCollection

Filters to only constant expressions, including constructors of a constant (e.g. both Repos::Foo and Repos::Foo.new).



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

def constants
  filter(&:constant_name)
end

#hash_literalsExpressionsCollection

Filters to only braced Hash-literal expressions.



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

def hash_literals
  filter(&:hash_literal?)
end