Module: RuboCop::Cop::RBS::Style::RedundantParentheses::BeforeTokenIfLparen

Included in:
RuboCop::Cop::RBS::Style::RedundantParentheses, ParenChecker
Defined in:
lib/rubocop/cop/rbs/style/redundant_parentheses.rb

Instance Method Summary collapse

Instance Method Details

#before_token_if_lparen(tokens, base, fun) {|b| ... } ⇒ Object

Yields:

  • (b)


21
22
23
24
25
26
27
28
29
# File 'lib/rubocop/cop/rbs/style/redundant_parentheses.rb', line 21

def before_token_if_lparen(tokens, base, fun)
  first_param = fun.each_param.first
  return unless first_param

  b, _ = token_before_after(tokens, first_param.location.start_pos - base)
  return unless b&.type == :pLPAREN

  yield b
end