Module: RubyCms::PathMap
- Defined in:
- lib/ruby_cms/path_map.rb
Overview
Converts between gem template-relative paths and host-app-relative paths.
Constant Summary collapse
- KEEP_PREFIXES =
%w[config/ db/ lib/].freeze
- ADMIN_LAYOUT_TEMPLATE =
"admin.html.erb"- ADMIN_LAYOUT_APP =
"app/views/layouts/admin.html.erb"
Class Method Summary collapse
Class Method Details
.to_app(template_relative) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/ruby_cms/path_map.rb', line 12 def to_app(template_relative) return ADMIN_LAYOUT_APP if template_relative == ADMIN_LAYOUT_TEMPLATE return template_relative if KEEP_PREFIXES.any? {|p| template_relative.start_with?(p) } "app/#{template_relative}" end |
.to_template(app_relative) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/ruby_cms/path_map.rb', line 19 def to_template(app_relative) return ADMIN_LAYOUT_TEMPLATE if app_relative == ADMIN_LAYOUT_APP return app_relative if KEEP_PREFIXES.any? {|p| app_relative.start_with?(p) } app_relative.delete_prefix("app/") end |