Module: Roda::RodaPlugins::TimestampPublic::InstanceMethods

Defined in:
lib/roda/plugins/timestamp_public.rb

Instance Method Summary collapse

Instance Method Details

#timestamp_path(file) ⇒ Object

Return a path to the static file that could be served by r.timestamp_public. This does not check the file is inside the directory for performance reasons, so this should not be called with untrusted input.



53
54
55
56
# File 'lib/roda/plugins/timestamp_public.rb', line 53

def timestamp_path(file)
  mtime = File.mtime(File.join(opts[:public_root], file))
  "/#{opts[:timestamp_public_prefix]}/#{sprintf("%i%06i", mtime.to_i, mtime.usec)}/#{file}"
end