Class: Middleman::Sitemap::Extensions::Ignores::IgnoreDescriptor

Inherits:
Struct
  • Object
show all
Defined in:
middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block


33
34
35
# File 'middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb', line 33

def block
  @block
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path


33
34
35
# File 'middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb', line 33

def path
  @path
end

Instance Method Details

#execute_descriptor(_app, resource_list) ⇒ Object


34
35
36
37
38
39
40
41
42
43
44
# File 'middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb', line 34

def execute_descriptor(_app, resource_list)
  resource_list.each do |r|
    # Ignore based on the source path (without template extensions)
    if ignored?(r.normalized_path)
      resource_list.update!(r, :ignored) { r.ignore! }
    elsif !r.is_a?(ProxyResource) && r.file_descriptor && ignored?(r.file_descriptor.normalized_relative_path)
      # This allows files to be ignored by their source file name (with template extensions)
      resource_list.update!(r, :ignored) { r.ignore! }
    end
  end
end

#ignored?(_match_path) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)

46
47
48
# File 'middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb', line 46

def ignored?(_match_path)
  raise NotImplementedError
end