Sha256: 741b6855dbddf3afd6d885822f89388bd13ce2fbd8218436ba02d348b665698c

Contents?: true

Size: 470 Bytes

Versions: 11

Compression:

Stored size: 470 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.exist?(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

11 entries across 11 versions & 1 rubygems

Version Path
erb-formatter-0.7.3 lib/erb/formatter/ignore_list.rb
erb-formatter-0.7.2 lib/erb/formatter/ignore_list.rb
erb-formatter-0.7.1 lib/erb/formatter/ignore_list.rb
erb-formatter-0.7.0 lib/erb/formatter/ignore_list.rb
erb-formatter-0.6.0 lib/erb/formatter/ignore_list.rb
erb-formatter-0.5.1 lib/erb/formatter/ignore_list.rb
erb-formatter-0.5.0 lib/erb/formatter/ignore_list.rb
erb-formatter-0.4.3 lib/erb/formatter/ignore_list.rb
erb-formatter-0.4.2 lib/erb/formatter/ignore_list.rb
erb-formatter-0.4.1 lib/erb/formatter/ignore_list.rb
erb-formatter-0.4.0 lib/erb/formatter/ignore_list.rb