Class: RubyNext::Language::Rewriters::ItParam

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby-next/language/rewriters/3.4/it_param.rb

Constant Summary collapse

NAME =
"it-param"
SYNTAX_PROBE =
"proc { it.keys }.call({})"
MIN_SUPPORTED_VERSION =
Gem::Version.new("3.4.0")

Instance Attribute Summary

Attributes inherited from Base

#locals

Instance Method Summary collapse

Methods inherited from Base

ast?, #initialize, #s

Methods inherited from Abstract

ast?, #initialize, text?, transform, unsupported_syntax?, unsupported_version?

Constructor Details

This class inherits a constructor from RubyNext::Language::Rewriters::Base

Instance Method Details

#on_block(node) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/ruby-next/language/rewriters/3.4/it_param.rb', line 13

def on_block(node)
  _proc_or_lambda, _args, body = *node.children

  return super if block_has_it_argument?(node)
  return super unless block_has_it_reference?(body)

  process_block(node)
end

#on_itblock(node) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/ruby-next/language/rewriters/3.4/it_param.rb', line 22

def on_itblock(node)
  _proc_or_lambda, _args, body = *node.children

  return super unless block_has_it_reference?(body)

  process_block(node)
end