class RuboCop::Cop::Lint::UnusedBlockArgument

Public Instance Methods

message(variable) click to toggle source
# File lib/rubocop/cop/lint/unused_block_argument.rb, line 7
def message(variable)
  message = "ζ*'ヮ')ζ<うっうー!#{variable_type(variable)}が使われてないですよー!" \
  " - `#{variable.name}`"

  if variable.explicit_block_local_variable?
    message
  else
    augment_message(message, variable)
  end
end
message_for_normal_block(variable, all_arguments) click to toggle source
# File lib/rubocop/cop/lint/unused_block_argument.rb, line 26
def message_for_normal_block(variable, all_arguments)
  if all_arguments.none?(&:referenced?) &&
     !define_method_call?(variable)
    '引数を省略できますよー!'
  else
    "使っていないものは `_` か `_#{variable.name}` にしましょうねー!"
  end
end
variable_type(variable) click to toggle source
# File lib/rubocop/cop/lint/unused_block_argument.rb, line 18
def variable_type(variable)
  if variable.explicit_block_local_variable?
    'ブロック内のローカル変数'
  else
    'ブロック変数'
  end
end