Class: Reek::Context::GhostContext
- Inherits:
-
ModuleContext
- Object
- CodeContext
- ModuleContext
- Reek::Context::GhostContext
- Defined in:
- lib/reek/context/ghost_context.rb
Overview
Semi-transparent context to represent a metaclass while building the context tree. This context will not be part of the resulting tree, but will track context and visibility separately while building is in progress.
Constant Summary
Constants inherited from ModuleContext
ModuleContext::CONSTANT_SEXP_TYPES
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Attributes inherited from ModuleContext
Attributes inherited from CodeContext
Instance Method Summary collapse
- #append_child_context(child) ⇒ Object
-
#attribute_context_class ⇒ Object
Return the correct class for child attribute contexts.
-
#method_context_class ⇒ Object
Return the correct class for child method contexts (representing nodes of type ‘:def`).
- #record_use_of_self ⇒ Object
- #register_with_parent(parent) ⇒ Object
- #statement_counter ⇒ Object
- #track_visibility(visibility, names) ⇒ Object
Methods inherited from ModuleContext
#defined_instance_methods, #descriptively_commented?, #initialize, #instance_method_calls, #instance_method_children, #instance_method_names_via_to_call, #namespace_module?, #node_instance_methods, #singleton_method_children
Methods inherited from CodeContext
#apply_current_visibility, #config_for, #configuration_via_code_commment, #each, #full_comment, #full_name, #initialize, #instance_method?, #local_nodes, #matches?, #number_of_statements, #parent_config_for, #record_call_to, #singleton_method?
Constructor Details
This class inherits a constructor from Reek::Context::ModuleContext
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
13 14 15 |
# File 'lib/reek/context/ghost_context.rb', line 13 def children @children end |
Instance Method Details
#append_child_context(child) ⇒ Object
19 20 21 22 23 |
# File 'lib/reek/context/ghost_context.rb', line 19 def append_child_context(child) real_parent = parent.append_child_context(child) super real_parent end |
#attribute_context_class ⇒ Object
Return the correct class for child attribute contexts. For GhostContext, this is the class that represents singleton attributes.
34 35 36 |
# File 'lib/reek/context/ghost_context.rb', line 34 def attribute_context_class SingletonAttributeContext end |
#method_context_class ⇒ Object
Return the correct class for child method contexts (representing nodes of type ‘:def`). For GhostContext, this is the class that represents singleton methods.
28 29 30 |
# File 'lib/reek/context/ghost_context.rb', line 28 def method_context_class SingletonMethodContext end |
#record_use_of_self ⇒ Object
44 45 46 |
# File 'lib/reek/context/ghost_context.rb', line 44 def record_use_of_self parent.record_use_of_self end |
#register_with_parent(parent) ⇒ Object
15 16 17 |
# File 'lib/reek/context/ghost_context.rb', line 15 def register_with_parent(parent) @parent = parent end |
#statement_counter ⇒ Object
48 49 50 |
# File 'lib/reek/context/ghost_context.rb', line 48 def statement_counter parent.statement_counter end |
#track_visibility(visibility, names) ⇒ Object
38 39 40 41 42 |
# File 'lib/reek/context/ghost_context.rb', line 38 def track_visibility(visibility, names) visibility_tracker.track_visibility children: children, visibility: visibility, names: names end |