Sha256: 76051cba3a1f973b1456c4ae8f6223c4d352fc4905b737b7f48dc3c7c3a65808

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

require 'rack/staticme_builder'

module Staticme

  class App

    attr_accessor :params

    def initialize(params)
      self.params = params
    end

    def bind
      params = self.params
      
      Rack::StaticmeBuilder.new do
        
        use Rack::CommonLogger
        
        index = params[:index]
        path = params[:path]

        map /^\/.+/ do
          run Rack::Directory.new( path )
        end

        if !index.nil? && File.exists?( File.join( path, index ) )
          map /^\/$/ do
            run Rack::File.new( File.join( path, index ) )
          end
        end
        
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
staticme-0.2.0 lib/staticme/app.rb