Parent

Files

Ramaze::Dispatcher::File

Monkeypatch to add support for multiple public_roots.

Public Class Methods

in_public?(path) click to toggle source
# File lib/thoth/monkeypatch/dispatcher/file.rb, line 34
def in_public?(path)
  path = expand(path)

  @expanded ||= {
    :default => expand(Ramaze::Global.public_root),
    :custom  => expand(Thoth::Config.theme.public)
  }

  path.start_with?(@expanded[:default]) ||
      path.start_with?(@expanded[:custom])
end
resolve_path(path) click to toggle source
# File lib/thoth/monkeypatch/dispatcher/file.rb, line 46
def resolve_path(path)
  joined = ::File.join(Thoth::Config.theme.public, path)

  unless ::File.exist?(joined)
    joined = ::File.join(Ramaze::Global.public_root, path)
  end

  if ::File.directory?(joined)
    Dir[joined/"{#{INDICES.join(',')}}"].first || joined
  else
    joined
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.