Skip to content

Commit f6fb9c5

Browse files
committed
Fix RuboCop::AST::NumericNode to return boolean
The documentation states that `sign?` returns boolean: ```ruby # Checks whether this is literal has a sign. # # @example # # +42 # # @return [Boolean] whether this literal has a sign. def sign? source.match(SIGN_REGEX) end ``` but it does not. Looks like the only usage [1] of `sign?` is this [2] module, so nothing should break. [1] https://github.com/search?q=org%3Arubocop%20sign%3F&type=code [2] https://github.com/rubocop/rubocop/blob/ddbb2a1bb65a29ac2d2d963196f7b00821779fd6/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb#L226
1 parent 4c51ecd commit f6fb9c5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#380](https://github.com/rubocop/rubocop-ast/pull/380): Fix `RuboCop::AST::NumericNode` to return boolean. ([@viralpraxis][])

lib/rubocop/ast/node/mixin/numeric_node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module NumericNode
1515
#
1616
# @return [Boolean] whether this literal has a sign.
1717
def sign?
18-
source.match(SIGN_REGEX)
18+
source.match?(SIGN_REGEX)
1919
end
2020
end
2121
end

0 commit comments

Comments
 (0)