Class: ProformaXML::TransformTask

Inherits:
ServiceBase show all
Defined in:
lib/proformaxml/services/transform_task.rb

Instance Method Summary collapse

Methods inherited from ServiceBase

call

Constructor Details

#initialize(task:, from_version:, to_version:) ⇒ TransformTask

Returns a new instance of TransformTask.



7
8
9
10
11
12
# File 'lib/proformaxml/services/transform_task.rb', line 7

def initialize(task:, from_version:, to_version:)
  super()
  @task = task
  @from_version = from_version
  @to_version = to_version
end

Instance Method Details

#performObject



14
15
16
17
18
19
20
21
# File 'lib/proformaxml/services/transform_task.rb', line 14

def perform
  if SCHEMA_VERSIONS.include?(@from_version) && SCHEMA_VERSIONS.include?(@to_version)

    method_name = "transform_from_#{@from_version.tr('.', '_')}_to_#{@to_version.tr('.', '_')}"

    send(method_name) if defined? method_name
  end
end