Class: Analyst::FileProcessor
- Inherits:
-
Object
- Object
- Analyst::FileProcessor
- Defined in:
- lib/analyst.rb
Instance Attribute Summary collapse
-
#path_to_files ⇒ Object
readonly
Returns the value of attribute path_to_files.
Instance Method Summary collapse
- #ast ⇒ Object
-
#initialize(path_to_files) ⇒ FileProcessor
constructor
A new instance of FileProcessor.
- #source_files ⇒ Object
Constructor Details
#initialize(path_to_files) ⇒ FileProcessor
Returns a new instance of FileProcessor.
33 34 35 |
# File 'lib/analyst.rb', line 33 def initialize(path_to_files) @path_to_files = path_to_files end |
Instance Attribute Details
#path_to_files ⇒ Object (readonly)
Returns the value of attribute path_to_files.
31 32 33 |
# File 'lib/analyst.rb', line 31 def path_to_files @path_to_files end |
Instance Method Details
#ast ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/analyst.rb', line 45 def ast ::Parser::AST::Node.new( :root, source_files.map do |file| content = File.open(file, "r").read ::Parser::CurrentRuby.parse(content) end ) end |
#source_files ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/analyst.rb', line 37 def source_files if File.directory?(path_to_files) return Dir.glob(File.join(path_to_files, "**", "*.rb")) else return [path_to_files] end end |