lib/rubocop/cop/lint/void.rb
# `initialize` and setter methods do not return value of last
# expression.
`initialize` and setter methods do not return value of last
expression.
` initialize ` and setter methods do not return value of last expression .
def in_void_context?(node)
          parent = node.parent
          return false unless parent
          return false unless parent.children.last == node
          case parent.type
          when :def
            method = parent.children.first
            method == :initialize || method.to_s.end_with?('=')
          when :for
            true
          when :block
            send = parent.children.first
            send.method?(:each)
          end
        end
def in_void_context? ( node ) parent = node . parent return false unless parent return false unless parent . children . last == node case parent . type when :def method = parent . children . first method == :initialize || method . to_s . end_with? ( '=' ) when :for true when :block send = parent . children . first send . method? ( :each ) end end
`initialize` and setter methods do not return value of last
expression.
` initialize ` and setter methods do not return value of last expression .
node