Class: Gamefic::Sdk::Platform::Web::AppConfig
- Inherits:
-
Object
- Object
- Gamefic::Sdk::Platform::Web::AppConfig
- Includes:
- Plot::Theater
- 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, js) ⇒ AppConfig
constructor
A new instance of AppConfig.
-
#render ⇒ String
Render HTML using the build config data.
Constructor Details
#initialize(source_dir, config, js) ⇒ AppConfig
Returns a new instance of AppConfig.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 11 def initialize source_dir, config, js @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.concat js end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 7 def config @config end |
#html_dir ⇒ Object (readonly)
Returns the value of attribute html_dir.
7 8 9 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 7 def html_dir @html_dir end |
#javascripts ⇒ Object (readonly)
Returns the value of attribute javascripts.
7 8 9 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 7 def javascripts @javascripts end |
#resource_paths ⇒ Object (readonly)
Returns the value of attribute resource_paths.
7 8 9 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 7 def resource_paths @resource_paths end |
#source_dir ⇒ Object (readonly)
Returns the value of attribute source_dir.
7 8 9 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 7 def source_dir @source_dir end |
#stylesheets ⇒ Object (readonly)
Returns the value of attribute stylesheets.
7 8 9 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 7 def stylesheets @stylesheets end |
Instance Method Details
#data ⇒ BuildConfig::Data
25 26 27 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 25 def data Data.new config, @javascripts, @stylesheets end |
#render ⇒ String
Render HTML using the build config data
32 33 34 35 |
# File 'lib/gamefic-sdk/platform/web/app_config.rb', line 32 def render erb = ERB.new(File.read(html_dir + "/index.html.erb")) erb.result data.get_binding end |