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

Inherits:
Struct
  • Object
show all
Defined in:
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 '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 'lib/middleman-core/sitemap/extensions/ignores.rb', line 35

def path
  @path
end

Instance Method Details

#execute_descriptor(_app, resources) ⇒ Object



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

def execute_descriptor(_app, resources)
  resources.map do |r|
    # Ignore based on the source path (without template extensions)
    if ignored?(r.normalized_path)
      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)
      r.ignore!
    end

    r
  end
end

#ignored?(_match_path) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

def ignored?(_match_path)
  raise NotImplementedError
end