Class: Temporalio::WorkerDeploymentVersion

Inherits:
Data
  • Object
show all
Defined in:
lib/temporalio/worker_deployment_version.rb,
lib/temporalio/worker_deployment_version.rb

Overview

Represents the version of a specific worker deployment.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deployment_name:, build_id:) ⇒ WorkerDeploymentVersion

Create WorkerDeploymentVersion.

Parameters:

  • The name of the deployment.

  • The build identifier specific to this worker build.



38
39
40
# File 'lib/temporalio/worker_deployment_version.rb', line 38

def initialize(deployment_name:, build_id:) # rubocop:disable Lint/UselessMethodDefinition
  super
end

Instance Attribute Details

#build_idObject (readonly)

Returns the value of attribute build_id

Returns:

  • the current value of build_id



6
7
8
# File 'lib/temporalio/worker_deployment_version.rb', line 6

def build_id
  @build_id
end

#deployment_nameObject (readonly)

Returns the value of attribute deployment_name

Returns:

  • the current value of deployment_name



6
7
8
# File 'lib/temporalio/worker_deployment_version.rb', line 6

def deployment_name
  @deployment_name
end

Class Method Details

.from_canonical_string(canonical) ⇒ WorkerDeploymentVersion

Parse a version from a canonical string, which must be in the format ‘<deployment_name>.<build_id>`. Deployment name must not have a . in it.

Parameters:

  • The canonical string representation of the version.

Returns:

  • The parsed version.



18
19
20
21
22
23
24
25
# File 'lib/temporalio/worker_deployment_version.rb', line 18

def self.from_canonical_string(canonical)
  parts = canonical.split('.', 2)
  if parts.length != 2
    raise ArgumentError,
          "Cannot parse version string: #{canonical}, must be in format <deployment_name>.<build_id>"
  end
  new(deployment_name: parts[0], build_id: parts[1])
end

Instance Method Details

#to_canonical_stringString

Returns the canonical string representation of the version.

Returns:



45
46
47
# File 'lib/temporalio/worker_deployment_version.rb', line 45

def to_canonical_string
  "#{deployment_name}.#{build_id}"
end