Class: RuboCop::AST::Node Private

Inherits:
Object show all
Includes:
Cask::Constants
Defined in:
rubocops/cask/extend/node.rb,
rubocops/cask/extend/node.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Constant Summary

Constants included from Cask::Constants

Cask::Constants::ON_SYSTEM_METHODS, Cask::Constants::ON_SYSTEM_METHODS_STANZA_ORDER, Cask::Constants::STANZA_GROUPS, Cask::Constants::STANZA_GROUP_HASH, Cask::Constants::STANZA_ORDER, Cask::Constants::UNINSTALL_METHODS_ORDER

Instance Method Summary collapse

Instance Method Details

#arch_variable?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


17
# File 'rubocops/cask/extend/node.rbi', line 17

def arch_variable?; end

#begin_block?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


20
# File 'rubocops/cask/extend/node.rbi', line 20

def begin_block?; end

#block_bodyRuboCop::AST::Node?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



8
# File 'rubocops/cask/extend/node.rbi', line 8

def block_body; end

#cask_block?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


11
# File 'rubocops/cask/extend/node.rbi', line 11

def cask_block?; end

#cask_on_system_block?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


19
20
21
# File 'rubocops/cask/extend/node.rb', line 19

def cask_on_system_block?
  (on_system_block? && each_ancestor.any?(&:cask_block?)) || false
end

#heredoc?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


33
34
35
# File 'rubocops/cask/extend/node.rb', line 33

def heredoc?
  loc.is_a?(Parser::Source::Map::Heredoc)
end

#location_expressionObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



37
38
39
40
41
42
# File 'rubocops/cask/extend/node.rb', line 37

def location_expression
  base_expression = loc.expression
  descendants.select(&:heredoc?).reduce(base_expression) do |expr, node|
    expr.join(node.loc.heredoc_end)
  end
end

#method_nodeRuboCop::AST::SendNode?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (RuboCop::AST::SendNode, nil)


5
# File 'rubocops/cask/extend/node.rbi', line 5

def method_node; end

#on_system_block?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


14
# File 'rubocops/cask/extend/node.rbi', line 14

def on_system_block?; end

#stanza?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
# File 'rubocops/cask/extend/node.rb', line 23

def stanza?
  return true if arch_variable?

  case self
  when RuboCop::AST::BlockNode, RuboCop::AST::SendNode
    ON_SYSTEM_METHODS.include?(method_name) || STANZA_ORDER.include?(method_name)
  else false
  end
end