Class: Middleman::Sitemap::Extensions::MoveFile::MoveFileDescriptor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fromObject

Returns the value of attribute from

Returns:

  • (Object)

    the current value of from


17
18
19
# File 'middleman-core/lib/middleman-core/sitemap/extensions/move_file.rb', line 17

def from
  @from
end

#toObject

Returns the value of attribute to

Returns:

  • (Object)

    the current value of to


17
18
19
# File 'middleman-core/lib/middleman-core/sitemap/extensions/move_file.rb', line 17

def to
  @to
end

Instance Method Details

#execute_descriptor(_app, resource_list) ⇒ Object


18
19
20
21
22
23
24
25
26
# File 'middleman-core/lib/middleman-core/sitemap/extensions/move_file.rb', line 18

def execute_descriptor(_app, resource_list)
  resource_list.each do |r|
    next unless from == r.path || from == r.destination_path

    resource_list.update!(r, :destination_path) do
      r.destination_path = to
    end
  end
end