Class: Lowkey::ClassVisitor
- Inherits:
-
Object
- Object
- Lowkey::ClassVisitor
- Includes:
- Query
- Defined in:
- lib/visitors/class_visitor.rb
Instance Attribute Summary collapse
-
#parent_map ⇒ Object
readonly
Returns the value of attribute parent_map.
Instance Method Summary collapse
- #file_path ⇒ Object
-
#initialize(file_proxy:, parent_map:) ⇒ ClassVisitor
constructor
A new instance of ClassVisitor.
- #lines ⇒ Object
- #visit(node) ⇒ Object
Methods included from Query
Constructor Details
#initialize(file_proxy:, parent_map:) ⇒ ClassVisitor
Returns a new instance of ClassVisitor.
10 11 12 13 |
# File 'lib/visitors/class_visitor.rb', line 10 def initialize(file_proxy:, parent_map:) @file_proxy = file_proxy @parent_map = parent_map end |
Instance Attribute Details
#parent_map ⇒ Object (readonly)
Returns the value of attribute parent_map.
21 22 23 |
# File 'lib/visitors/class_visitor.rb', line 21 def parent_map @parent_map end |
Instance Method Details
#file_path ⇒ Object
23 24 25 |
# File 'lib/visitors/class_visitor.rb', line 23 def file_path @file_proxy.file_path end |
#lines ⇒ Object
27 28 29 |
# File 'lib/visitors/class_visitor.rb', line 27 def lines @file_proxy.lines end |
#visit(node) ⇒ Object
15 16 17 18 19 |
# File 'lib/visitors/class_visitor.rb', line 15 def visit(node) namespace = namespace(node:, parent_map:) || return class_proxy = ProxyFactory.class_proxy(node:, namespace:, file_path:, lines:) @file_proxy.upsert_definition(module_proxy: class_proxy) end |