class CodeKeeper::Parser

Search and parse ruby file

Attributes

processed_source[R]

Public Class Methods

new(file_path) click to toggle source
# File lib/code_keeper/parser.rb, line 8
def initialize(file_path)
  source = File.read(File.expand_path(file_path))
  @processed_source = ::RuboCop::AST::ProcessedSource.new(source, 3.0)
rescue Errno::ENOENT
  raise TargetFileNotFoundError, "The target file does not exist. Check the file path: #{file_path}."
end
parse(file_path) click to toggle source
# File lib/code_keeper/parser.rb, line 16
def parse(file_path)
  parser = new(file_path)
  parser.processed_source
end