Class: Mumukit::Server::App
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Mumukit::Server::App
- Includes:
- WithAssets
- Defined in:
- lib/assets_server.rb
Class Method Summary collapse
- .get_board_asset(route, path, type) ⇒ Object
- .get_editor_asset(route, path, type) ⇒ Object
- .get_local_svg(name, asset_type) ⇒ Object
- .get_media_assets(folder, content_type = nil) ⇒ Object
- .get_submit_asset(route, path, type) ⇒ Object
Class Method Details
.get_board_asset(route, path, type) ⇒ Object
4 5 6 |
# File 'lib/assets_server.rb', line 4 def self.get_board_asset(route, path, type) get_asset route, Gobstones::Board.assets_path_for(path), type end |
.get_editor_asset(route, path, type) ⇒ Object
8 9 10 |
# File 'lib/assets_server.rb', line 8 def self.get_editor_asset(route, path, type) get_asset route, Gobstones::Blockly.assets_path_for(path), type end |
.get_local_svg(name, asset_type) ⇒ Object
16 17 18 |
# File 'lib/assets_server.rb', line 16 def self.get_local_svg(name, asset_type) get_local_asset "#{asset_type}/#{name}.svg", "lib/public/#{name}.svg", 'image/svg+xml' end |
.get_media_assets(folder, content_type = nil) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/assets_server.rb', line 20 def self.get_media_assets(folder, content_type = nil) Dir.glob(File.join(__dir__,"../lib/public/#{folder}/*")).each do |path| relative_media_asset_path = "#{folder}/#{File.basename path}" get_local_asset relative_media_asset_path, "lib/public/#{relative_media_asset_path}", content_type end end |
.get_submit_asset(route, path, type) ⇒ Object
12 13 14 |
# File 'lib/assets_server.rb', line 12 def self.get_submit_asset(route, path, type) get_asset route, Gobstones::CodeRunner.assets_path_for(path), type end |