Class: PrivateDetective::AnalyzeFile
- Inherits:
-
Object
- Object
- PrivateDetective::AnalyzeFile
- Defined in:
- lib/private_detective/analyze_file.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Instance Method Summary collapse
-
#analyze_file ⇒ Hash
Report.
-
#initialize(file_path:, report:) ⇒ AnalyzeFile
constructor
A new instance of AnalyzeFile.
Constructor Details
#initialize(file_path:, report:) ⇒ AnalyzeFile
Returns a new instance of AnalyzeFile.
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_path ⇒ Object (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 |
#node ⇒ Object (readonly)
Returns the value of attribute node.
6 7 8 |
# File 'lib/private_detective/analyze_file.rb', line 6 def node @node end |
#report ⇒ Object (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_file ⇒ Hash
Returns 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 |