Class: Rubocop::Cop::VariableInspector::Scope
- Inherits:
-
Object
- Object
- Rubocop::Cop::VariableInspector::Scope
- Defined in:
- lib/rubocop/cop/variable_inspector.rb
Overview
A Scope represents a context of local variable visibility. This is a place where local variables belong to. A scope instance holds a scope node and variable entries.
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#variable_entries ⇒ Object
readonly
Returns the value of attribute variable_entries.
Instance Method Summary collapse
-
#initialize(node) ⇒ Scope
constructor
A new instance of Scope.
Constructor Details
#initialize(node) ⇒ Scope
Returns a new instance of Scope.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rubocop/cop/variable_inspector.rb', line 50 def initialize(node) # Accept begin node for top level scope. unless SCOPE_TYPES.include?(node.type) || node.type == :begin fail ArgumentError, "Node type must be any of #{SCOPE_TYPES}, " + "passed #{node.type}" end @node = node @variable_entries = {} end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
48 49 50 |
# File 'lib/rubocop/cop/variable_inspector.rb', line 48 def node @node end |
#variable_entries ⇒ Object (readonly)
Returns the value of attribute variable_entries.
48 49 50 |
# File 'lib/rubocop/cop/variable_inspector.rb', line 48 def variable_entries @variable_entries end |