module TyranoDsl::ExportGame::WritingWords::WritingWordsModule
A module to help writing writing word
Public Instance Methods
fetch_scene(world, word_location, scene_name)
click to toggle source
Get a scene from its name @param [TyranoDsl::Elements::World] world @param [Array<String>] word_location @param [String] scene_name @return [TyranoDsl::Elements::Scene] @raise [TyranoDsl::TyranoException] if the scene does not exist
# File lib/tyrano_dsl/export_game/writing_words/writing_words_module.rb, line 15 def fetch_scene(world, word_location, scene_name) target_scene = world.scenes[scene_name] unless target_scene raise_unknown('scene', scene_name, world.scenes.keys, word_location) end target_scene end
h(text)
click to toggle source
HTML escape text @param [String] text @return [String]
# File lib/tyrano_dsl/export_game/writing_words/writing_words_module.rb, line 26 def h(text) CGI::escapeHTML(text) end
raise_unknown(type, unknown_name, current_elements, word_location)
click to toggle source
@param [String] type @param [String] unknown_name @param [Array<String>] current_elements @return [void] @raise [TyranoDsl::TyranoException]
# File lib/tyrano_dsl/export_game/writing_words/writing_words_module.rb, line 35 def raise_unknown(type, unknown_name, current_elements, word_location) exception = TyranoDsl::TyranoException.new("Unknown #{type} [#{unknown_name}], currently #{current_elements.length} defined: #{current_elements.sort.collect {|e| "[#{e}]"}.join(', ')}") exception.set_backtrace word_location raise exception end