Class: Pronto::Punchlist::FileClassifier

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/punchlist/file_classifier.rb

Overview

Classify whether files are relevant to punchlist

Instance Method Summary collapse

Constructor Details

#initialize(source_file_globber: SourceFinder::SourceFileGlobber.new) ⇒ FileClassifier

Returns a new instance of FileClassifier.



7
8
9
# File 'lib/pronto/punchlist/file_classifier.rb', line 7

def initialize(source_file_globber: SourceFinder::SourceFileGlobber.new)
  @source_file_globber = source_file_globber
end

Instance Method Details

#non_binary?(path) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
# File 'lib/pronto/punchlist/file_classifier.rb', line 11

def non_binary?(path)
  # https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch
  # EXTGLOB enables ',' as part of glob language
  File.fnmatch?(@source_file_globber.source_and_doc_files_glob,
                path,
                File::FNM_EXTGLOB)
end