Sha256: 2ed8508875033279db2dd31dab139b2fddb9c07f72081f1651b9aff716012cd1
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
module Gobstones module CompilationMode module Classic class << self def compile_extra(extra) extra end def compile_content(content) content end end end module GameFramework class << self def compile_extra(extra) [extra, extra_code] end def compile_content(content) if blockly_code?(content) xml = Nokogiri::XML(content) xml.root.add_child render_framework_file('program.xml') xml.to_xhtml.gsub(/\n\s*/, '') else <<~GBS #{content} #{program_code} GBS .chop end end def extra_code render_framework_file 'extra.gbs' end def program_code render_framework_file 'program.gbs' end def default_code render_framework_file 'default.xml' end private def blockly_code?(content) content.strip.start_with? '<xml' end def render_framework_file(name) ERB.new(File.read("lib/game_framework/#{name}.erb")).result end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mumuki-gobstones-runner-2.8.1 | lib/gobstones/compilation_mode.rb |
mumuki-gobstones-runner-2.8.0 | lib/gobstones/compilation_mode.rb |