Class: Gramrb::FileScanner
- Inherits:
-
Object
- Object
- Gramrb::FileScanner
- Defined in:
- lib/gramrb/file_scanner.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ FileScanner
constructor
A new instance of FileScanner.
- #scan ⇒ Object
Constructor Details
#initialize(path) ⇒ FileScanner
Returns a new instance of FileScanner.
3 4 5 6 7 8 9 10 11 |
# File 'lib/gramrb/file_scanner.rb', line 3 def initialize(path) raise ArgumentError, ".#{File.extname(path)} files are not supported" if File.extname(path) != '.rb' @path = path @filename = File.basename(path, '.rb') @content = ContentExtractor.new(File.read(path)).extract_all @spell_checker = SpellChecker.new(Config.new.allowlisted) @string_cleaner = StringCleaner.new end |
Instance Method Details
#scan ⇒ Object
13 |
# File 'lib/gramrb/file_scanner.rb', line 13 def scan = (filename_errors + content_errors).any? ? { @path => { filename_errors:, content_errors: } } : {} |