Module: RuboCop::AST::NumericNode

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

Overview

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

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.



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

def sign?
  source.match(SIGN_REGEX)
end