UtopiaSourceUtopiaContentLinksResolver

class Resolver

Represents a list of class Utopia::Content::Link instances relating to the structure of the content. They are formed from the links.yaml file and the actual directory structure on disk.

Definitions

def load_directory(name, metadata, &block)

Implementation

def load_directory(name, metadata, &block)
	defaults = metadata.delete(name) || {}
	
	links = @links.links(@top + name).indices
	
	links.each do |link|
		# We extract the metadata according to the localized link:
		if info = metadata.delete("#{name}.#{link.locale}")
			info = info.merge(link.info)
		else
			info = link.info
		end
		
		yield Link.new(:directory, name, link.locale, link.path, defaults.merge(info))
	end
end

def load_default_index(name = INDEX, info = {})

The default index for a directory which has no contents.

Implementation

def load_default_index(name = INDEX, info = {})
	path = @top + name
	
	if info
		info = DEFAULT_INDEX_INFO.merge(info)
	else
		info = DEFAULT_INDEX_INFO
	end
	
	# Specify a nil uri if no index could be found for the directory:
	yield Link.new(:index, name, nil, @top.to_directory, info, path[-2])
end