Module: Rubyzen::Providers::ReturnsProvider

Included in:
Declarations::BlockDeclaration, Declarations::MethodDeclaration
Defined in:
lib/rubyzen/providers/returns_provider.rb

Overview

Provides the points at which a method or block yields a value: the implicit final expression of its body, plus every explicit return. Each is wrapped in a Declarations::ReturnDeclaration, which knows how to extract its own value.

Instance Method Summary collapse

Instance Method Details

#return_expressionsRubyzen::Collections::ExpressionsCollection

The value-expression(s) this method or block evaluates to, as a flat collection. A shortcut for returns.expressions.



20
21
22
# File 'lib/rubyzen/providers/returns_provider.rb', line 20

def return_expressions
  returns.expressions
end

#returnsRubyzen::Collections::ReturnsCollection



8
9
10
11
12
13
14
# File 'lib/rubyzen/providers/returns_provider.rb', line 8

def returns
  Collections::ReturnsCollection.new(
    return_nodes.map do |return_node|
      Declarations::ReturnDeclaration.new(return_node, self)
    end
  )
end