Module: RuboCop::AST::NumericNode

Included in:
FloatNode, IntNode
Defined in:
lib/rubocop/ast/node/mixin/numeric_node.rb

Overview

Common functionality for primitive numeric nodes: `int`, `float`, …

Constant Summary collapse

SIGN_REGEX =
/\A[+-]/.freeze

Instance Method Summary collapse

Instance Method Details

#sign?Boolean

Checks whether this is literal has a sign.

Examples:


+42

Returns:

  • (Boolean)

    whether this literal has a sign.


16
17
18
# File 'lib/rubocop/ast/node/mixin/numeric_node.rb', line 16

def sign?
  source.match(SIGN_REGEX)
end