Module: Rubocop::Cop::Blocks

Included in:
MultilineBlocks, SingleLineBlocks
Defined in:
lib/rubocop/cop/blocks.rb

Instance Method Summary collapse

Instance Method Details

#inspect(file, source, tokens, sexp) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rubocop/cop/blocks.rb', line 6

def inspect(file, source, tokens, sexp)
  @file = file

  # The @reverse_correlations maps grammar path object ids to
  # token indexes, so we can use it to find the corresponding }
  # for each {.
  @reverse_correlations = Hash.new([])
  @correlations.each do |ix, path|
    @reverse_correlations[path.object_id] += [ix]
  end

  tokens.each_index { |ix| check(tokens, ix) }
end