Class: PrivateDetective::AnalyzeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/private_detective/analyze_node.rb

Constant Summary collapse

ACCESS_CONTROL_KEYWORDS =
%i[public private protected].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node:, file_path: nil) ⇒ AnalyzeNode

Returns a new instance of AnalyzeNode.

Parameters:

  • node, (Parser::AST::Node)
    String

    file_path



11
12
13
14
15
# File 'lib/private_detective/analyze_node.rb', line 11

def initialize(node:, file_path: nil)
  @class_details, @super_class, @class_body = *node
  @file_path = file_path
  @report = { class_name => [] }
end

Instance Attribute Details

#class_bodyObject (readonly)

Returns the value of attribute class_body.



8
9
10
# File 'lib/private_detective/analyze_node.rb', line 8

def class_body
  @class_body
end

#class_detailsObject (readonly)

Returns the value of attribute class_details.



8
9
10
# File 'lib/private_detective/analyze_node.rb', line 8

def class_details
  @class_details
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



8
9
10
# File 'lib/private_detective/analyze_node.rb', line 8

def file_path
  @file_path
end

#reportObject (readonly)

Returns the value of attribute report.



8
9
10
# File 'lib/private_detective/analyze_node.rb', line 8

def report
  @report
end

#super_classObject (readonly)

Returns the value of attribute super_class.



8
9
10
# File 'lib/private_detective/analyze_node.rb', line 8

def super_class
  @super_class
end

Instance Method Details

#process_nodeHash

Returns report.

Returns:

  • (Hash)

    report



18
19
20
21
22
# File 'lib/private_detective/analyze_node.rb', line 18

def process_node
  return unless class_pattern?

  create_report
end