Class: MRubyPortable::BuildWorkspace::RuntimeTemplateContext

Inherits:
Object
  • Object
show all
Defined in:
lib/mruby_portable/build_workspace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, mode:, xmb_asset_filenames:) ⇒ RuntimeTemplateContext

Returns a new instance of RuntimeTemplateContext.



135
136
137
138
139
# File 'lib/mruby_portable/build_workspace.rb', line 135

def initialize(config, mode:, xmb_asset_filenames:)
  @config = config
  @mode = mode
  @xmb_asset_filenames = xmb_asset_filenames
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



133
134
135
# File 'lib/mruby_portable/build_workspace.rb', line 133

def config
  @config
end

#modeObject (readonly)

Returns the value of attribute mode.



133
134
135
# File 'lib/mruby_portable/build_workspace.rb', line 133

def mode
  @mode
end

#xmb_asset_filenamesObject (readonly)

Returns the value of attribute xmb_asset_filenames.



133
134
135
# File 'lib/mruby_portable/build_workspace.rb', line 133

def xmb_asset_filenames
  @xmb_asset_filenames
end

Instance Method Details

#cmake_background_pathObject



170
171
172
# File 'lib/mruby_portable/build_workspace.rb', line 170

def cmake_background_path
  cmake_xmb_asset_path(:background)
end

#cmake_icon_pathObject



166
167
168
# File 'lib/mruby_portable/build_workspace.rb', line 166

def cmake_icon_path
  cmake_xmb_asset_path(:icon)
end

#cmake_preview_pathObject



174
175
176
# File 'lib/mruby_portable/build_workspace.rb', line 174

def cmake_preview_path
  cmake_xmb_asset_path(:preview)
end

#cmake_preview_video_pathObject



178
179
180
# File 'lib/mruby_portable/build_workspace.rb', line 178

def cmake_preview_video_path
  cmake_xmb_asset_path(:preview_video)
end

#cmake_string(value) ⇒ Object



153
154
155
156
# File 'lib/mruby_portable/build_workspace.rb', line 153

def cmake_string(value)
  escaped = value.to_s.gsub("\\", "/").gsub('"', '\"')
  "\"#{escaped}\""
end

#cmake_titleObject



158
159
160
# File 'lib/mruby_portable/build_workspace.rb', line 158

def cmake_title
  cmake_string(config.title)
end

#cmake_versionObject



162
163
164
# File 'lib/mruby_portable/build_workspace.rb', line 162

def cmake_version
  cmake_string(config.version)
end

#cmake_xmb_asset_path(key) ⇒ Object



182
183
184
185
# File 'lib/mruby_portable/build_workspace.rb', line 182

def cmake_xmb_asset_path(key)
  filename = xmb_asset_filenames[key]
  filename ? cmake_string("${CMAKE_CURRENT_SOURCE_DIR}/xmb/#{filename}") : "NULL"
end

#embedded?Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/mruby_portable/build_workspace.rb', line 145

def embedded?
  mode == "release"
end

#get_bindingObject



141
142
143
# File 'lib/mruby_portable/build_workspace.rb', line 141

def get_binding
  binding
end

#target_nameObject



149
150
151
# File 'lib/mruby_portable/build_workspace.rb', line 149

def target_name
  config.target_name
end