Class: Inferno::Utils::StaticAssets
- Inherits:
-
Object
- Object
- Inferno::Utils::StaticAssets
- Defined in:
- lib/inferno/utils/static_assets.rb
Class Method Summary collapse
- .base_path ⇒ Object
- .inferno_path ⇒ Object
- .public_path ⇒ Object
- .static_assets_folder ⇒ Object
-
.static_assets_map ⇒ Object
A hash of urls => file_paths which will be served with ‘Rack::Static`.
Class Method Details
.base_path ⇒ Object
11 12 13 |
# File 'lib/inferno/utils/static_assets.rb', line 11 def base_path @base_path ||= Application['base_path'] end |
.inferno_path ⇒ Object
19 20 21 |
# File 'lib/inferno/utils/static_assets.rb', line 19 def inferno_path @inferno_path ||= File.(File.join(__dir__, '..')) end |
.public_path ⇒ Object
15 16 17 |
# File 'lib/inferno/utils/static_assets.rb', line 15 def public_path @public_path ||= "/#{base_path}/public".gsub('//', '/') end |
.static_assets_folder ⇒ Object
6 7 8 9 |
# File 'lib/inferno/utils/static_assets.rb', line 6 def static_assets_folder @static_assets_folder ||= File.(File.join(inferno_path, 'public')) end |
.static_assets_map ⇒ Object
A hash of urls => file_paths which will be served with ‘Rack::Static`
24 25 26 27 28 29 |
# File 'lib/inferno/utils/static_assets.rb', line 24 def static_assets_map Dir.glob(File.join(static_assets_folder, '*')) .each_with_object({}) do |filename, hash| hash["#{public_path}/#{File.basename(filename)}"] = filename.delete_prefix(inferno_path) end end |