Class: Middleman::Sitemap::Extensions::Import::ImportPathDescriptor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fromObject

Returns the value of attribute from



23
24
25
# File 'middleman-core/lib/middleman-core/sitemap/extensions/import.rb', line 23

def from
  @from
end

#renameProcObject

Returns the value of attribute renameProc



23
24
25
# File 'middleman-core/lib/middleman-core/sitemap/extensions/import.rb', line 23

def renameProc
  @renameProc
end

Instance Method Details

#execute_descriptor(app, resources) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'middleman-core/lib/middleman-core/sitemap/extensions/import.rb', line 24

def execute_descriptor(app, resources)
  resources + ::Middleman::Util.glob_directory(File.join(from, '**/*'))
                               .reject { |path| File.directory?(path) }
                               .map do |path|
                target_path = Pathname(path).relative_path_from(Pathname(from).parent).to_s

                ::Middleman::Sitemap::Resource.new(
                  app.sitemap,
                  renameProc.call(target_path, path),
                  path
                )
              end
end