class Mumuki::Domain::Store::Thesaurus::InfoConverter
Public Class Methods
new(runner_url, info)
click to toggle source
# File lib/mumuki/domain/store/thesaurus.rb, line 28 def initialize(runner_url, info) @runner_url = runner_url @info = info end
Public Instance Methods
absolutize(urls)
click to toggle source
# File lib/mumuki/domain/store/thesaurus.rb, line 76 def absolutize(urls) urls.map { |url| "#{@runner_url}/#{url}"} end
call()
click to toggle source
# File lib/mumuki/domain/store/thesaurus.rb, line 33 def call { name: @info['name'], comment_type: @info['comment_type'], runner_url: @runner_url, output_content_type: @info['output_content_type'], prompt: (@info.dig('language', 'prompt') || 'ム') + ' ', extension: @info.dig('language', 'extension'), highlight_mode: @info.dig('language', 'ace_mode'), visible_success_output: @info.dig('language', 'graphic').present?, devicon: @info.dig('language', 'icon', 'name'), expectations: feature_present?('expectations'), feedback: feature_present?('feedback'), multifile: feature_present?('multifile'), queriable: feature_present?('query'), settings: feature_present?('settings'), stateful_console: feature_present?('stateful'), triable: feature_present?('try'), test_extension: @info.dig('test_framework', 'test_extension'), test_template: @info.dig('test_framework', 'template'), layout_js_urls: get_assets_for(:layout, 'js'), layout_html_urls: get_assets_for(:layout, 'html'), layout_css_urls: get_assets_for(:layout, 'css'), editor_js_urls: get_assets_for(:editor, 'js'), editor_html_urls: get_assets_for(:editor, 'html'), editor_css_urls: get_assets_for(:editor, 'css'), layout_shows_loading_content: shows_loading_content_for?(:layout), editor_shows_loading_content: shows_loading_content_for?(:editor) } end
feature_present?(feature)
click to toggle source
# File lib/mumuki/domain/store/thesaurus.rb, line 64 def feature_present?(feature) @info.dig('features', feature).present? end
get_asset_field(kind, field)
click to toggle source
# File lib/mumuki/domain/store/thesaurus.rb, line 72 def get_asset_field(kind, field) @info.dig("#{kind}_assets_urls", field) end
get_assets_for(kind, content_type)
click to toggle source
# File lib/mumuki/domain/store/thesaurus.rb, line 68 def get_assets_for(kind, content_type) absolutize(get_asset_field(kind, content_type) || []) end
shows_loading_content_for?(kind)
click to toggle source
# File lib/mumuki/domain/store/thesaurus.rb, line 80 def shows_loading_content_for?(kind) get_asset_field(kind, 'shows_loading_content').present? end