Class: RuboCop::Cop::Lint::UnusedBlockArgument
- Defined in:
- lib/rubocop/cop/lint/unused_block_argument.rb
Instance Method Summary collapse
- #message(variable) ⇒ Object
- #message_for_normal_block(variable, all_arguments) ⇒ Object
- #variable_type(variable) ⇒ Object
Instance Method Details
#message(variable) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rubocop/cop/lint/unused_block_argument.rb', line 7 def (variable) = "ζ*'ヮ')ζ<うっうー!#{variable_type(variable)}が使われてないですよー!" \ " - `#{variable.name}`" if variable.explicit_block_local_variable? else (, variable) end end |
#message_for_normal_block(variable, all_arguments) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/rubocop/cop/lint/unused_block_argument.rb', line 26 def (variable, all_arguments) if all_arguments.none?(&:referenced?) && !define_method_call?(variable) '引数を省略できますよー!' else "使っていないものは `_` か `_#{variable.name}` にしましょうねー!" end end |
#variable_type(variable) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rubocop/cop/lint/unused_block_argument.rb', line 18 def variable_type(variable) if variable.explicit_block_local_variable? 'ブロック内のローカル変数' else 'ブロック変数' end end |