Class: PrivateDetective::AnalyzeFile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path:, report:) ⇒ AnalyzeFile

Returns a new instance of AnalyzeFile.

Parameters:

  • file_path, (String)
    Hash

    report



9
10
11
12
# File 'lib/private_detective/analyze_file.rb', line 9

def initialize(file_path:, report:)
  @file_path = file_path
  @report = report
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



6
7
8
# File 'lib/private_detective/analyze_file.rb', line 6

def file_path
  @file_path
end

#nodeObject (readonly)

Returns the value of attribute node.



6
7
8
# File 'lib/private_detective/analyze_file.rb', line 6

def node
  @node
end

#reportObject (readonly)

Returns the value of attribute report.



6
7
8
# File 'lib/private_detective/analyze_file.rb', line 6

def report
  @report
end

Instance Method Details

#analyze_fileHash

Returns report.

Returns:

  • (Hash)

    report



15
16
17
18
19
20
# File 'lib/private_detective/analyze_file.rb', line 15

def analyze_file
  @node = Parser::CurrentRuby.parse(File.read(file_path))
  return unless node.is_a?(Parser::AST::Node)

  analyze_node
end