Sha256: fbc2a9fbd757e64cd8d7da00712a5e7161b5a6bcf232242dfa7b96cf2385739f

Contents?: true

Size: 463 Bytes

Versions: 2

Compression:

Stored size: 463 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
      File.fnmatch? File.expand_path(_1.chomp, @base_dir), path
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
erb-formatter-0.1.1 lib/erb/formatter/ignore_list.rb
erb-formatter-0.1.0 lib/erb/formatter/ignore_list.rb