Class: Gamefic::Sdk::Platform::Web::AppConfig
- Inherits:
-
Object
- Object
- Gamefic::Sdk::Platform::Web::AppConfig
- Includes:
- Stage
- Defined in:
- lib/gamefic-sdk/platform/web/app_config.rb
Defined Under Namespace
Classes: Data
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#html_dir ⇒ Object
readonly
Returns the value of attribute html_dir.
-
#javascripts ⇒ Object
readonly
Returns the value of attribute javascripts.
-
#resource_paths ⇒ Object
readonly
Returns the value of attribute resource_paths.
-
#source_dir ⇒ Object
readonly
Returns the value of attribute source_dir.
-
#stylesheets ⇒ Object
readonly
Returns the value of attribute stylesheets.
Instance Method Summary collapse
- #data ⇒ BuildConfig::Data
-
#initialize(source_dir, config) ⇒ AppConfig
constructor
A new instance of AppConfig.
-
#render ⇒ String
Render HTML using the build config data.
Constructor Details
#initialize(source_dir, config) ⇒ AppConfig
Returns a new instance of AppConfig.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 12 def initialize source_dir, config @javascripts = [] @stylesheets = [] @source_dir = source_dir @config = config @html_dir = resolve_html_dir @game_config = PlotConfig.new("#{source_dir}/config.yaml") @resource_paths = ["#{html_dir}", Gamefic::Sdk::HTML_TEMPLATE_PATH] config_file = "#{html_dir}/index.rb" stage File.read(config_file), config_file javascripts.push "core/opal.js", "core/gamefic.js", "core/static.js", "core/scripts.js", "core/engine.js" end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 8 def config @config end |
#html_dir ⇒ Object (readonly)
Returns the value of attribute html_dir.
8 9 10 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 8 def html_dir @html_dir end |
#javascripts ⇒ Object (readonly)
Returns the value of attribute javascripts.
8 9 10 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 8 def javascripts @javascripts end |
#resource_paths ⇒ Object (readonly)
Returns the value of attribute resource_paths.
8 9 10 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 8 def resource_paths @resource_paths end |
#source_dir ⇒ Object (readonly)
Returns the value of attribute source_dir.
8 9 10 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 8 def source_dir @source_dir end |
#stylesheets ⇒ Object (readonly)
Returns the value of attribute stylesheets.
8 9 10 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 8 def stylesheets @stylesheets end |
Instance Method Details
#data ⇒ BuildConfig::Data
26 27 28 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 26 def data Data.new @game_config, @javascripts, @stylesheets end |
#render ⇒ String
Render HTML using the build config data
33 34 35 36 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 33 def render erb = ERB.new(File.read(html_dir + "/index.html.erb")) erb.result data.get_binding end |