Method: Liquid::LocalFileSystem#full_path

Defined in:
lib/liquid/file_system.rb

#full_path(template_path) ⇒ Object

Raises:



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/liquid/file_system.rb', line 59

def full_path(template_path)
  raise FileSystemError, "Illegal template name '#{template_path}'" unless template_path =~ /\A[^.\/][a-zA-Z0-9_\/]+\z/

  full_path = if template_path.include?('/'.freeze)
    File.join(root, File.dirname(template_path), @pattern % File.basename(template_path))
  else
    File.join(root, @pattern % template_path)
  end

  raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'" unless File.expand_path(full_path) =~ /\A#{File.expand_path(root)}/

  full_path
end