Class: OodCore::BatchConnect::Template
- Inherits:
-
Object
- Object
- OodCore::BatchConnect::Template
- Defined in:
- lib/ood_core/batch_connect/template.rb
Overview
A template class that renders a batch script designed to facilitate external connections to the running job
Direct Known Subclasses
OodCore::BatchConnect::Templates::Basic, OodCore::BatchConnect::Templates::VNC
Instance Attribute Summary collapse
-
#context ⇒ Hash
readonly
The context used to render this template.
Instance Method Summary collapse
-
#initialize(context = {}) ⇒ Template
constructor
A new instance of Template.
-
#to_s ⇒ String
Render this template as string.
Constructor Details
#initialize(context = {}) ⇒ Template
Returns a new instance of Template.
52 53 54 55 |
# File 'lib/ood_core/batch_connect/template.rb', line 52 def initialize(context = {}) @context = context.to_h.compact.symbolize_keys raise ArgumentError, "No work_dir specified. Missing argument: work_dir" unless context.include?(:work_dir) end |
Instance Attribute Details
#context ⇒ Hash (readonly)
The context used to render this template
13 14 15 |
# File 'lib/ood_core/batch_connect/template.rb', line 13 def context @context end |
Instance Method Details
#to_s ⇒ String
Render this template as string
59 60 61 62 63 64 65 |
# File 'lib/ood_core/batch_connect/template.rb', line 59 def to_s <<-EOT.gsub(/^ {10}/, '') #!/bin/bash #{script_wrapper} EOT end |