Class: Zui::ApplicationRuntime
- Inherits:
-
Object
- Object
- Zui::ApplicationRuntime
- Defined in:
- lib/zui/application_runtime.rb
Constant Summary collapse
- FORMAT =
1
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#executable ⇒ Object
readonly
Returns the value of attribute executable.
-
#gems ⇒ Object
readonly
Returns the value of attribute gems.
-
#load_path ⇒ Object
readonly
Returns the value of attribute load_path.
-
#program ⇒ Object
readonly
Returns the value of attribute program.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(engine:, version:, executable:, environment: {}, gems: [], program: nil, load_path: nil) ⇒ ApplicationRuntime
constructor
A new instance of ApplicationRuntime.
- #to_h ⇒ Object
- #write(directory) ⇒ Object
Constructor Details
#initialize(engine:, version:, executable:, environment: {}, gems: [], program: nil, load_path: nil) ⇒ ApplicationRuntime
Returns a new instance of ApplicationRuntime.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/zui/application_runtime.rb', line 11 def initialize(engine:, version:, executable:, environment: {}, gems: [], program: nil, load_path: nil) @engine = engine.to_s @version = version.to_s @executable = executable.to_s @environment = environment.transform_keys(&:to_s).transform_values do |paths| Array(paths).map(&:to_s).freeze end.freeze @gems = Array(gems).map(&:to_s).sort.freeze @program = program&.to_s @load_path = load_path&.to_s freeze end |
Instance Attribute Details
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
9 10 11 |
# File 'lib/zui/application_runtime.rb', line 9 def engine @engine end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
9 10 11 |
# File 'lib/zui/application_runtime.rb', line 9 def environment @environment end |
#executable ⇒ Object (readonly)
Returns the value of attribute executable.
9 10 11 |
# File 'lib/zui/application_runtime.rb', line 9 def executable @executable end |
#gems ⇒ Object (readonly)
Returns the value of attribute gems.
9 10 11 |
# File 'lib/zui/application_runtime.rb', line 9 def gems @gems end |
#load_path ⇒ Object (readonly)
Returns the value of attribute load_path.
9 10 11 |
# File 'lib/zui/application_runtime.rb', line 9 def load_path @load_path end |
#program ⇒ Object (readonly)
Returns the value of attribute program.
9 10 11 |
# File 'lib/zui/application_runtime.rb', line 9 def program @program end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/zui/application_runtime.rb', line 9 def version @version end |
Instance Method Details
#to_h ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/zui/application_runtime.rb', line 29 def to_h result = { "format" => FORMAT, "engine" => engine, "version" => version, "executable" => executable, "environment" => environment, "gems" => gems } result["program"] = program unless program.nil? result["load_path"] = load_path unless load_path.nil? result end |
#write(directory) ⇒ Object
24 25 26 27 |
# File 'lib/zui/application_runtime.rb', line 24 def write(directory) File.write(File.join(directory, "runtime.json"), "#{JSON.pretty_generate(to_h)}\n") self end |