Class: XMP2Assert::Classifier

Inherits:
Ripper
  • Object
show all
Defined in:
lib/xmp2assert/classifier.rb

Overview

Usually, you want to check LOTS of files that may or may not contain xmp comments at once, maybe from inside of a CI process. That's OK but we want to speed things up, so here we filter out files that are not necessary to convert.

Typical usage:

Pathname.glob('**/*.rb').select do |f|
  XMP2Assert::Classifier.classify(f)
end

Class Method Summary collapse

Class Method Details

.classify(qfile) ⇒ <Symbol>

Note:

syntax error results in empty return value.

Returns either empty, :=>, :>>, or both.

Parameters:

Returns:

  • (<Symbol>)

    either empty, :=>, :>>, or both.



46
47
48
49
50
51
52
53
54
# File 'lib/xmp2assert/classifier.rb', line 46

def self.classify qfile
  case qfile when XMP2Assert::Quasifile then
    this = new qfile.read, qfile.__FILE__, qfile.__LINE__
    return this.send :parse
  else
    q = XMP2Assert::Quasifile.new qfile
    return classify q
  end
end