Class: RuboCop::Cask::AST::CaskHeader Private
- Defined in:
- rubocops/cask/ast/cask_header.rb
Overview
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.
This class wraps the AST method node that represents the cask header. It includes various helper methods to aid cops in their analysis.
Instance Attribute Summary collapse
- #method_node ⇒ T.all(RuboCop::AST::Node, RuboCop::AST::ParameterizedNode::RestArguments) readonly private
Instance Method Summary collapse
- #cask_token ⇒ String private
- #hash_node ⇒ T.all(RuboCop::AST::Node, RuboCop::AST::ParameterizedNode::RestArguments) private
- #initialize(method_node) ⇒ void constructor private
- #source_range ⇒ Parser::Source::Range private
Constructor Details
#initialize(method_node) ⇒ void
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.
11 12 13 |
# File 'rubocops/cask/ast/cask_header.rb', line 11 def initialize(method_node) @method_node = method_node end |
Instance Attribute Details
#method_node ⇒ T.all(RuboCop::AST::Node, RuboCop::AST::ParameterizedNode::RestArguments) (readonly)
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.
16 17 18 |
# File 'rubocops/cask/ast/cask_header.rb', line 16 def method_node @method_node end |
Instance Method Details
#cask_token ⇒ String
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.
24 25 26 |
# File 'rubocops/cask/ast/cask_header.rb', line 24 def cask_token @cask_token ||= T.let(method_node.first_argument.str_content, T.nilable(String)) end |
#hash_node ⇒ T.all(RuboCop::AST::Node, RuboCop::AST::ParameterizedNode::RestArguments)
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.
29 30 31 |
# File 'rubocops/cask/ast/cask_header.rb', line 29 def hash_node @hash_node ||= T.let(method_node.each_child_node(:hash).first, T.nilable(RuboCop::AST::Node)) end |
#source_range ⇒ Parser::Source::Range
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.
19 20 21 |
# File 'rubocops/cask/ast/cask_header.rb', line 19 def source_range @source_range ||= T.let(method_node.loc.expression, T.nilable(Parser::Source::Range)) end |