Sha256: 962fb55f5cb317b728a1e6d12221c1261b6b6f70d40d5b08b47297d27454616f

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

class ERB::Formatter::IgnoreList
  def initialize(contents: nil, base_dir: Dir.pwd)
    ignore_list_path = "#{base_dir}/.format-erb-ignore"
    @contents = contents || (File.exists?(ignore_list_path) ? File.read(ignore_list_path) : '')
    @ignore_list = @contents.lines
  end

  def should_ignore_file?(path)
    path = File.expand_path(path, @base_dir)
    @ignore_list.any? do |line|
      File.fnmatch? File.expand_path(line.chomp, @base_dir), path
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
erb-formatter-0.3.0 lib/erb/formatter/ignore_list.rb
erb-formatter-0.2.2 lib/erb/formatter/ignore_list.rb
erb-formatter-0.2.1 lib/erb/formatter/ignore_list.rb
erb-formatter-0.2.0 lib/erb/formatter/ignore_list.rb