Class: RuboCop::Cop::Lecture::ExplainSymbolToProc
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Lecture::ExplainSymbolToProc
- Defined in:
- lib/rubocop/cop/lecture/explain_symbol_to_proc.rb
Overview
foo.bar(&:baz) は次のコードと同じです。
foo.bar do |x|
x.baz
end
Constant Summary collapse
- MSG =
<<~STRING foo.bar(&:baz) は次のコードと同じです。 foo.bar do |x| x.baz end STRING
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/rubocop/cop/lecture/explain_symbol_to_proc.rb', line 30 def on_send(node) block_pass_potential_node = node.arguments.first if block_pass_potential_node && block_pass_potential_node.type == :block_pass && block_pass_potential_node.child_nodes.first.sym_type? add_offense(node) end end |