Class: HtmlScssClassChecker::FileProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/html_scss_class_checker/file_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path, file_type) ⇒ FileProcessor

Returns a new instance of FileProcessor.



6
7
8
9
# File 'lib/html_scss_class_checker/file_processor.rb', line 6

def initialize(file_path, file_type)
  @file_path = file_path
  @file_type = file_type
end

Instance Method Details

#list_classesObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/html_scss_class_checker/file_processor.rb', line 11

def list_classes
  content = File.read(@file_path)
  case @file_type
  when 'html'
    ClassExtractor.extract_from_html(content)
  when 'scss'
    ClassExtractor.extract_from_scss(content)
  else
    Set.new
  end
end