Class: Precious::MapGollum

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/gollum/app.rb

Overview

For use with the --base-path option.

Constant Summary

Constants included from Helpers

Helpers::EMOJI_PATHNAME

Instance Method Summary collapse

Methods included from Helpers

#clean_url, #emoji, #encodeURI, #find_per_page_upload_subdir, #forbid, #not_found, #not_found_proc, #remove_leading_and_trailing_slashes, #sanitize_empty_params, #strip_page_name

Constructor Details

#initialize(base_path) ⇒ MapGollum



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/gollum/app.rb', line 59

def initialize(base_path)
  base_route = "/#{remove_leading_and_trailing_slashes(base_path)}"
  @mg = Rack::Builder.new do

    map base_route do
      run Precious::App
    end
    map '/' do
      run Proc.new { [302, { 'Location' => base_route }, []] }
    end
    map '/*' do
      run Proc.new { [302, { 'Location' => base_route }, []] }
    end

  end
end

Instance Method Details

#call(env) ⇒ Object



76
77
78
# File 'lib/gollum/app.rb', line 76

def call(env)
  @mg.call(env)
end