class RuboCop::AST::OrNode
A node extension for `or` nodes. This will be used in place of a plain node when the builder constructs the AST, making its methods available to all `or` nodes within RuboCop.
Public Instance Methods
alternate_operator()
click to toggle source
Returns the alternate operator of the `or` as a string. Returns `or` for `||` and vice versa.
@return [String] the alternate of the `or` operator
# File lib/rubocop/ast/node/or_node.rb, line 15 def alternate_operator logical_operator? ? SEMANTIC_OR : LOGICAL_OR end
inverse_operator()
click to toggle source
Returns the inverse keyword of the `or` node as a string. Returns `and` for `or` and `&&` for `||`.
@return [String] the inverse of the `or` operator
# File lib/rubocop/ast/node/or_node.rb, line 23 def inverse_operator logical_operator? ? LOGICAL_AND : SEMANTIC_AND end
node_parts()
click to toggle source
Custom destructuring method. This can be used to normalize destructuring for different variations of the node.
@return [Array<Node>] the different parts of the `or` predicate
# File lib/rubocop/ast/node/or_node.rb, line 31 def node_parts to_a end