Class: TyranoDsl::ElementsWriters::SceneWriter

Inherits:
Object
  • Object
show all
Includes:
ElementsWritersModule
Defined in:
lib/tyrano_dsl/elements_writers/scene_writer.rb

Overview

Write a scene

Instance Method Summary collapse

Instance Method Details

#write(scene, scene_content, assets) ⇒ Array

Parameters:

Returns:

  • (Array)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tyrano_dsl/elements_writers/scene_writer.rb', line 13

def write(scene, scene_content, assets)
  log {"Writing scene [#{scene.name}]"}
  content_text_content = "[_tb_system_call storage=system/_#{scene.target_name}.ks]\n[cm]\n#{scene_content.join("\n")}\n"
  preload_text_content = preload_text(assets.to_a)
  [
      TyranoDsl::FileActions::CreateFile.new(
          File.join('data', 'scenario', "#{scene.target_name}.ks"),
          content_text_content
      ),
      TyranoDsl::FileActions::CreateFile.new(
          File.join('data', 'scenario', 'system', "_#{scene.target_name}.ks"),
          preload_text_content
      )

  ]
end