Class: Serve::Rails::Mount
- Inherits:
-
Object
- Object
- Serve::Rails::Mount
- Defined in:
- lib/serve/rails/mount.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
Instance Method Summary collapse
-
#append_view_helper(module_name) ⇒ Object
Appends to the collection of view helpers that will be made availabe to the DynamicHandler.
- #connection ⇒ Object
-
#initialize(route, root) ⇒ Mount
constructor
A new instance of Mount.
- #resolve_path(path) ⇒ Object
- #view_helpers ⇒ Object
Constructor Details
Instance Attribute Details
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
4 5 6 |
# File 'lib/serve/rails/mount.rb', line 4 def root_path @root_path end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
4 5 6 |
# File 'lib/serve/rails/mount.rb', line 4 def route @route end |
Instance Method Details
#append_view_helper(module_name) ⇒ Object
Appends to the collection of view helpers that will be made availabe to the DynamicHandler. These should be module names. They will be constantized in order to allow for re-loading in development mode.
15 16 17 |
# File 'lib/serve/rails/mount.rb', line 15 def append_view_helper(module_name) @view_helper_module_names << module_name end |
#connection ⇒ Object
19 20 21 |
# File 'lib/serve/rails/mount.rb', line 19 def connection @route == '/' ? '*path' : "#{@route}/*path" end |
#resolve_path(path) ⇒ Object
23 24 25 |
# File 'lib/serve/rails/mount.rb', line 23 def resolve_path(path) Serve.resolve_file(@root_path, path) end |
#view_helpers ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/serve/rails/mount.rb', line 27 def view_helpers helpers = Module.new @view_helper_module_names.each do |module_name| helpers.module_eval do include module_name.constantize end end helpers end |