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


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

def block
  @block
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path


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

def path
  @path
end

Instance Method Details

#execute_descriptor(_app, resource_list) ⇒ Object


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

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)

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

def ignored?(_match_path)
  raise NotImplementedError
end