Module: Textus::Key::Path

Defined in:
lib/textus/key/path.rb

Class Method Summary collapse

Class Method Details

.resolve(data, mentry) ⇒ Object

Returns the absolute filesystem path for a manifest entry (the leaf file, not a nested directory). Adds the format’s primary extension when the manifest entry’s ‘path:` is extensionless.

The first argument is a Manifest::Data (or anything responding to .root); callers historically passed the whole Manifest but should now pass ‘manifest.data`.



11
12
13
14
15
16
17
18
# File 'lib/textus/key/path.rb', line 11

def self.resolve(data, mentry)
  primary_ext = Entry.for_format(mentry.format).extensions.first
  if File.extname(mentry.path) == ""
    File.join(data.root, "zones", mentry.path + primary_ext)
  else
    File.join(data.root, "zones", mentry.path)
  end
end