class Stormy::Static

Public Class Methods

new(root) click to toggle source
# File lib/stormy/static.rb, line 3
def initialize(root)
  @root = root
  @rack_file = Rack::File.new(root)
end

Public Instance Methods

can_serve?(path) click to toggle source
# File lib/stormy/static.rb, line 8
def can_serve?(path)
  extension = Stormy::Template.extract_extension(path)

  if !Stormy::Template.rendered_extension?(extension)
    File.exists?(File.join(@root, path))
  end
end
serve(path) click to toggle source
# File lib/stormy/static.rb, line 16
def serve(path)
  @rack_file.call("PATH_INFO" => path, "REQUEST_METHOD"=>"GET")
end