Commit 223f096e authored by Peter Leitzen's avatar Peter Leitzen Committed by Stan Hu

Fix code docs for RuboCop's helper methods

`(const nil :Foo)` vs `(const nil? :Foo)`
parent 19289323
...@@ -25,7 +25,7 @@ module RuboCop ...@@ -25,7 +25,7 @@ module RuboCop
# Returns the name of a constant node. # Returns the name of a constant node.
# #
# Given the AST node `(const nil :Foo)`, this method will return `:Foo`. # Given the AST node `(const nil? :Foo)`, this method will return `:Foo`.
def name_of_constant(node) def name_of_constant(node)
node.children[1] node.children[1]
end end
...@@ -87,7 +87,7 @@ module RuboCop ...@@ -87,7 +87,7 @@ module RuboCop
# Returns the receiver name of a send node. # Returns the receiver name of a send node.
# #
# For the AST node `(send (const nil :Foo) ...)` this would return # For the AST node `(send (const nil? :Foo) ...)` this would return
# `'Foo'`. # `'Foo'`.
def name_of_receiver(node) def name_of_receiver(node)
name_of_constant(node.children.first).to_s name_of_constant(node.children.first).to_s
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment