Class: Loom::Shell::HarnessBlob

Inherits:
Object
  • Object
show all
Defined in:
lib/loom/shell/harness_blob.rb

Overview

A blob of commands fit for sending to the harness.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd_blob) ⇒ HarnessBlob

Returns a new instance of HarnessBlob.



9
10
11
# File 'lib/loom/shell/harness_blob.rb', line 9

def initialize(cmd_blob)
  @cmd_blob = cmd_blob
end

Instance Attribute Details

#cmd_blobObject (readonly)

Returns the value of attribute cmd_blob.



13
14
15
# File 'lib/loom/shell/harness_blob.rb', line 13

def cmd_blob
  @cmd_blob
end

Instance Method Details

#checksumObject



22
23
24
# File 'lib/loom/shell/harness_blob.rb', line 22

def checksum
  Digest::SHA1.hexdigest encoded_script
end

#encoded_scriptObject



15
16
17
18
19
20
# File 'lib/loom/shell/harness_blob.rb', line 15

def encoded_script
  # TODO: Fix this trailing newline hack, it is here to make encoding
  # consistent with the harness.sh script, which is a bit messy with how it
  # treats trailing newlines.
  Base64.encode64(cmd_blob + "\n")
end