class Rubocop::Cop::Style::NumericLiterals

This cop checks for big numeric literals without _ between groups of digits in them.

Constants

MSG

Public Instance Methods

on_float(node)
Alias for: on_int
on_int(node) click to toggle source
# File lib/rubocop/cop/style/numeric_literals.rb, line 12
def on_int(node)
  value, = *node

  if value > 10000 &&
      node.loc.expression.source.split('.').grep(/\d{6}/).any?
    add_offence(:convention, node.loc.expression, MSG)
  end
end
Also aliased as: on_float